示例#1
0
        public ScaleEntity Create(ScaleEntity scaleEntity)
        {
            Scale scale = scaleEntity.ToModel();

            smartDeliveryContext.Scale.Add(scale);
            smartDeliveryContext.SaveChanges();
            return(new ScaleEntity(scale));
        }
示例#2
0
        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));
        }
示例#3
0
 public ScaleEntity Update(Guid scaleId, [FromBody] ScaleEntity scaleEntity)
 {
     return(scaleService.Update(scaleId, scaleEntity));
 }
示例#4
0
 public ScaleEntity Create([FromBody] ScaleEntity scaleEntity)
 {
     return(scaleService.Create(scaleEntity));
 }