public ScaleEntity Create(ScaleEntity scaleEntity) { Scale scale = scaleEntity.ToModel(); smartDeliveryContext.Scale.Add(scale); smartDeliveryContext.SaveChanges(); return(new ScaleEntity(scale)); }
public ScaleEntity Update(Guid scaleId, ScaleEntity scaleEntity) { Scale scale = smartDeliveryContext.Scale.Where(m => m.Id == scaleId) .Include(u => u.Goods) .FirstOrDefault(); if (scale == null) { throw new BadRequestException("Scale khong ton tai"); } scaleEntity.ToModel(scale); smartDeliveryContext.Scale.Update(scale); smartDeliveryContext.SaveChanges(); return(new ScaleEntity(scale)); }
public ScaleEntity Update(Guid scaleId, [FromBody] ScaleEntity scaleEntity) { return(scaleService.Update(scaleId, scaleEntity)); }
public ScaleEntity Create([FromBody] ScaleEntity scaleEntity) { return(scaleService.Create(scaleEntity)); }