public GoodsEntity Create(GoodsEntity goodsEntity) { Goods good = goodsEntity.ToModel(); smartDeliveryContext.Goods.Add(good); smartDeliveryContext.SaveChanges(); return new GoodsEntity(good); }
public GoodsEntity Update(Guid goodsId, GoodsEntity goodsEntity) { Goods good = smartDeliveryContext.Goods.Where(m => m.Id == goodsId).FirstOrDefault(); if (good == null) throw new BadRequestException("Good khong ton tai"); goodsEntity.ToModel(good); smartDeliveryContext.Goods.Update(good); smartDeliveryContext.SaveChanges(); return new GoodsEntity(good); }
public GoodsEntity Update(Guid goodsId, [FromBody] GoodsEntity goodsEntity) { return(goodsService.Update(goodsId, goodsEntity)); }
public GoodsEntity Create([FromBody] GoodsEntity goodsEntity) { return(goodsService.Create(goodsEntity)); }