public void CreateNewInventory(NewInventoryRequestDto newInventoryRequestDto)
        {
            InventoryEventDto eventDto = null;

            try
            {
                _inventoryDao.InsertInventory(new InventoryDto
                {
                    Description = newInventoryRequestDto.Description,
                    StartDate   = DateTime.Now,
                    StatusId    = 1,
                    ZoneId      = newInventoryRequestDto.ZoneId
                });

                eventDto = new InventoryEventDto
                {
                    Description = "New inventory created",
                    EventDate   = DateTime.Now,
                    EventType   = (int)InventoryEventTypeEnum.InventoryCreated,
                    InventoryId = 0
                };
            }
            catch (Exception e)
            {
                eventDto = new InventoryEventDto
                {
                    Description = e.Message,
                    EventDate   = DateTime.Now,
                    InventoryId = 0,
                    EventType   = (int)InventoryEventTypeEnum.UnknownError
                };
            }
            finally
            {
                _inventoryDao.AddInventoryEvent(eventDto);
            }
        }
Exemple #2
0
 public ActionResult AddNewInventory([FromBody] NewInventoryRequestDto dto)
 {
     _inventoryService.CreateNewInventory(dto);
     return(Ok());
 }