//public IEnumerable<ClothItem> GetClothByName(string name) //{ // var query = from c in appDbContext.ClothItems // where c.Name.ToLower().StartsWith(name.ToLower()) || string.IsNullOrEmpty(name) // orderby c.Name // select c; // return query; //} public ClothItem Update(ClothItem updatedClothItem) { var entity = appDbContext.ClothItems.Attach(updatedClothItem); entity.State = EntityState.Modified; appDbContext.SaveChanges(); return(updatedClothItem); }
public ClothItem Create(ClothItem newClothItem) { appDbContext.Add(newClothItem); appDbContext.SaveChanges(); return(newClothItem); }