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