public IActionResult MoveOrders([FromBody] MoveOrdersDTO model)
 {
     try
     {
         var result = _recordService.MoveOrders(model);
         return(Ok(result));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
示例#2
0
        public bool MoveOrders(MoveOrdersDTO ordersDTO)
        {
            long userId = _principalService.GetUserId();

            if (ordersDTO.RecordId == -1)
            {
                Record record = new Record
                {
                    Id          = 0,
                    AreaGroupId = ordersDTO.AreaGroupId,
                    CreatedById = userId,
                    CreatedAt   = DateTime.Now,
                    IsActive    = true,
                    RecordDate  = ordersDTO.RecordDate
                };
                _db.Records.Add(record);
                _db.SaveChanges();
                return(BindRecordOrders(ordersDTO.Orders, record.Id));
            }
            return(BindRecordOrders(ordersDTO.Orders, ordersDTO.RecordId));
        }