public ActionResult AddNewQuotation(InsertQuotation model) { int i = 0; if (!ModelState.IsValid) { return(View(model)); } Quotation qc = new Quotation(); qc.ContactName = model.ContactName; qc.Address = model.Address; qc.Phone = model.Phone; qc.Email = model.Email; qc.CustomerTypeID = Convert.ToInt32(model.CustomerTypeID); qc.QuotationServiceTypeID = Convert.ToInt32(model.QuotationServiceTypeID); qc.CustomerID = Convert.ToInt32(model.CustomerID); qc.BranchID = branchID; qc.CreatedBy = userName; if (model.IsExitingCustomer) { qc.CustomerID = model.CustomerID; } else { qc.CustomerID = null; } i = _quotationService.InsertQuotation(qc); if (i > 0) { return(RedirectToAction("AddItemsForQuotation", new { id = qc.QuotationID })); } else { return(View(model)); } }