public IActionResult Save() { string userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var q = new SaveTask(_configuration); string Username = q.FindUsername(userId); var b = new TaskEntity { Title = HttpContext.Request.Form["Title"], Description = HttpContext.Request.Form["Description"], Location = HttpContext.Request.Form["Location"], Duration = int.Parse(HttpContext.Request.Form["Duration"]), Category = Request.Form["Category"], CreatedBy = Username, DateCreated = DateTime.Now.ToString("dddd, dd MMMM yyyy") }; q.InsertTask(b); return(RedirectToAction("Index")); }