Esempio n. 1
0
        public async Task <IActionResult> AddWarehouse(WarehouseResource wh)
        {
            if (await warehouseRepository.IsWarehouseExists(wh.Name.ToLower()))
            {
                return(BadRequest(wh.Name + " already exists!"));
            }

            var warehouseToAdd = new Warehouse
            {
                Name = wh.Name.ToLower(),
                Note = wh.Note
            };

            await warehouseRepository.Addwarehouse(warehouseToAdd);

            await unitOfWork.CompleteAsync();

            return(Ok());
        }