public async Task <IActionResult> Index(QuotationAddViewModel model) { if (ModelState.IsValid) { var appUser = await _userManager.FindByNameAsync(User.Identity.Name); var userId = appUser.Id; model.AppUserId = userId; Entities.Concrete.Quotation quotation = new Entities.Concrete.Quotation { AppUserId = model.AppUserId, QuotationText = model.QuotationText, BookId = model.BookId, CurrentPage = model.CurrentPage, QuotesLike = model.QuotesLike, CreatedOn = DateTime.Now, }; _quotationService.Add(quotation); } return(RedirectToAction("Index", "Quotation")); }
public ActionResult Create(QuotationViewModel item) { try { // TODO: Add insert logic here Quotation AVM = new Quotation(); AVM.Id = item.Id; AVM.Date_expiration = item.Date_expiration; AVM.QuoteNo = item.QuoteNo; AVM.Total = item.Total; AVM.TVA = item.TVA; QuotationService.Add(AVM); QuotationService.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }