public async Task <ActionResult> AddProductsManually([FromBody] IAddProductsToBasket items) { items.ProductAmount = Math.Abs(items.ProductAmount); var username = User.Claims.FirstOrDefault(x => x.Type == "FullName").Value; var situation = await CatalogService.AddProductsToCatalogManually(items); if (situation == ProblemWithBasket.AllIsOkey) { var catalogFromDB = await DB.CatalogDB.Include(x => x.Warehouse).FirstOrDefaultAsync(x => x.Id == items.CatalogId); var catalogVM = new CatalogVM { Id = catalogFromDB.Id, ProductPrice = catalogFromDB.ProductPrice, CurrentAmount = catalogFromDB.CurrentAmount, MaximumAmount = catalogFromDB.MaximumAmount, MinimumAmount = catalogFromDB.MinimumAmount, WarehouseId = catalogFromDB.WarehouseId, Name = catalogFromDB.Name.Name, }; var log = new SimpleLogTable() { Date = DateTime.Now, UserName = username, Action = "Pievienots", What = items.Name, Amount = items.ProductAmount, Manually = "Manuāli", WarehouseId = catalogFromDB.WarehouseId.Value, Where = catalogFromDB.Warehouse.Name }; await SimpleLogTableService.AddLog(log); return(Ok(catalogVM)); } else { return(BadRequest(new { message = "Something went wrong." })); } }