public IActionResult Post([FromForm] OrderApiRequest request) { // try // { // Validator.Validate(request); // } // catch (ValidationException e) // { // return BadRequest(e.Message); // } // catch (ArgumentNullException e) // { // return BadRequest(e.Message); // } try { OrderService.AddOrder(request); //var recipient = _configuration["Email:Smtp:RecipientEmail"]; //_emailService.Send("*****@*****.**", "????? ????? ?? ?????????? ??????????", "? ??? ????? ?????"); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public static void AddOrder(OrderApiRequest request) { try { Order order = new Order { Name = request.Name, Phone = request.Phone, Date = DateTime.Now, ProductId = request.ProductId, Adress = request.Adress, }; Orders.AddOrUpdate(order); } catch (Exception ex) { } }