public ActionResult AuctionOrder(AuctionOrderModel auctionOrderModel) { if (ModelState.IsValid) { Order order = new Order(); order.Date = DateTime.Now; order.Auction.Lots.Add(new Lot { Name = auctionOrderModel.LotName, Quantity = Convert.ToDecimal(auctionOrderModel.Count.Replace(".", ",")), UnitId = auctionOrderModel.UnitId, Price = Convert.ToDecimal(auctionOrderModel.Price.Replace(".", ",")), Sum = Convert.ToDecimal(auctionOrderModel.Amount.Replace(".", ",")), Step = Convert.ToDecimal(auctionOrderModel.Step.Replace(".", ",")), Warranty = Convert.ToDecimal(auctionOrderModel.TradeWarranty.Replace(".", ",")), LocalContent = Convert.ToInt32(auctionOrderModel.Percent), DeliveryPlace = auctionOrderModel.DeliveryPlace + "|" + auctionOrderModel.DeliveryTerm, DeliveryTime = auctionOrderModel.DeliveryTime, PaymentTerm = auctionOrderModel.Payment }); try { order.Auction.OwnerId = DataBaseClient.GetUserByLogin(HttpContext.User.Identity.Name).Id; } catch (Exception) { order.Auction.OwnerId = 1; } order.Auction.Comments = auctionOrderModel.MinimalSum + "|" + auctionOrderModel.Comments; var statusModel = new StatusModel(); try { DataBaseClient.SetNewKarazhiraOrder(order); statusModel.Status = 1; EmailSender.Send("*****@*****.**", "ablrzaieneayisqa", "*****@*****.**", "Новая заявка Каражыры от " + DateTime.Now.ToShortDateString() + " по лоту " + order.Auction.Lots[0].Name, "Не забудьте обработать!"); LogService.LogInfo("Order created successfuly"); } catch (Exception ex) { statusModel.Status = 0; LogService.LogInfo("Order created with error: " + ex); } return(View("CreateStatus", statusModel)); } else { try { auctionOrderModel.units = DataBaseClient.GetUnits(); LogService.LogInfo("AuctionOrder page re-opened because validation summary error"); } catch (Exception ex) { LogService.LogInfo("AuctionOrder page re-opened with error: " + ex); return(null); } return(View(auctionOrderModel)); } }