public IActionResult Index() { PanelIndexViewModel model = new PanelIndexViewModel(); var companyId = User.Identity.CompanyId(); model.Company = _companyService.GetById(companyId); model.Customers = _customerService.GetListByCompanyId(companyId); TempData["CompanyId"] = companyId.ToString(); return(View(model)); }
public IActionResult Index(PanelIndexViewModel model) { var companyId = User.Identity.CompanyId(); model.Company = _companyService.GetById(companyId); model.Customers = _customerService.GetListByCompanyId(companyId); if (string.IsNullOrEmpty(model.Customer.CitizienNumber)) { ModelState.AddModelError("TcError", "T.C. alanı boş geçilemez."); return(View(model)); } else { model.Customer.CompanyId = int.Parse(TempData["CompanyId"].ToString()); _customerService.Add(model.Customer); return(RedirectToAction("Index", model)); } }