Ejemplo n.º 1
0
        //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);
        }
Ejemplo n.º 2
0
 public ClothItem Create(ClothItem newClothItem)
 {
     appDbContext.Add(newClothItem);
     appDbContext.SaveChanges();
     return(newClothItem);
 }