Correcting bug
continuous-integration/drone/push Build is passing Details

Arthur_More
Arthur VALIN 2 years ago
parent 0dc5acc2f0
commit 361a7fe9d5

@ -24,17 +24,14 @@ namespace Business
public async Task<bool> DeleteItem(Champion? item) public async Task<bool> DeleteItem(Champion? item)
{ {
try var toDelete = parent.DbContext.champions.Find(item.Name);
if (toDelete!=null)
{ {
var toDelete = parent.DbContext.champions.Find(item.Name); parent.DbContext.champions.Remove(toDelete);
if (toDelete!=null) parent.DbContext.SaveChanges();
{ return true;
parent.DbContext.champions.Remove(toDelete);
parent.DbContext.SaveChanges();
return true;
}
return false;
} }
return false;
} }
public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false) public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)

@ -49,7 +49,7 @@ namespace Business
return parent.DbContext.skins.Include("Champion").GetItemsWithFilterAndOrdering( return parent.DbContext.skins.Include("Champion").GetItemsWithFilterAndOrdering(
s => s.Name.Contains(substring), s => s.Name.Contains(substring),
index, count, index, count,
orderingPropertyName, descending).Select(s => s?.ToModel()); orderingPropertyName, descending).Select(s => s.ToModel());
} }
public async Task<int> GetNbItems() public async Task<int> GetNbItems()

@ -1,37 +0,0 @@
using Shared;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities
{
public class SkinEntity
{
[Key]
[MaxLength(256)]
public string Name { get; set; }
[Required]
[MaxLength(500)]
public string Description { get; set; }
[Required]
public string Icon { get; set; }
[Required]
public float Price { get; set; }
[Required]
public string ChampionForeignKey { get; set; }
[ForeignKey("ChampionForeignKey")]
public ChampionEntity Champion { get; set; }
public Guid? ImageId { get; set; }
[ForeignKey("ImageId")]
public LargeImageEntity? Image { get; set; }
}
}
Loading…
Cancel
Save