Esempio n. 1
0
        public async Task <IActionResult> Create(Import import)
        {
            try
            {
                import.TotalPrice = import.Details.Sum(detail => detail.Price * detail.Quantity);
                import.Time       = DateTime.Now;
                var createdImport = await impServ.Create(import);

                return(Ok(createdImport));
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                return(StatusCode(500));
            }
        }