public IActionResult UpdatePackingType(PackingTypeDto packingTypeDto)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var packingType = _repository.PackingType.FindByCondition(c => c.Id == packingTypeDto.Id).FirstOrDefault();
                if (packingType == null)
                {
                    return(NotFound());
                }
                packingType.Name    = packingTypeDto.Name;
                packingType.Price   = packingTypeDto.Price;
                packingType.Weight  = packingTypeDto.Weight;
                packingType.Mdate   = DateTime.Now.Ticks;
                packingType.MuserId = ClaimPrincipalFactory.GetUserId(User);
                _repository.PackingType.Update(packingType);
                _repository.Save();
                return(NoContent());
            }
            catch (Exception e)
            {
                return(BadRequest("Internal Server Error"));
            }
        }
 public IActionResult InsertPackingType(PackingTypeDto packingTypeDto)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         var packingType = _mapper.Map <PackingType>(packingTypeDto);
         packingType.Cdate   = DateTime.Now.Ticks;
         packingType.CuserId = ClaimPrincipalFactory.GetUserId(User);
         _repository.PackingType.Create(packingType);
         _repository.Save();
         return(Created("", packingType));
     }
     catch (Exception e)
     {
         return(BadRequest("Internal Server Error"));
     }
 }