public IActionResult AddAddress(ClientAddress clientAddress) { if (HttpContext.Session.GetString("LoginID") == null) { return(RedirectToAction("Login", "Users")); } if (!(HttpContext.Session.GetString("AdminValidity") == "Admin" || HttpContext.Session.GetString("AdminValidity") == "Super Admin")) { return(RedirectToAction("Error", "Admin")); } CentricsContext context = HttpContext.RequestServices.GetService(typeof(Centrics.Models.CentricsContext)) as CentricsContext; context.AddAdresstoClientAddressList(clientAddress); context.LogAction("Client", "New address (" + clientAddress.Address + ") has been added to " + clientAddress.ClientCompany + ".", context.GetUser(Convert.ToInt32(HttpContext.Session.GetString("LoginID")))); return(RedirectToAction("Company", new { name = clientAddress.ClientCompany })); }