public async Task <IActionResult> Add(Location model) { if (ModelState.IsValid) { var user = await GetCurrentUserAsync(); var siteId = user.SiteID; model.SiteId = siteId; model.CreatedBy = user.Name; model.CreatedDate = DateTime.Now; _repository.AddLocation(model); ModelState.Clear(); return(RedirectToAction("list", new { id = "success" })); } return(View()); }