public IActionResult EditSympathizer(SympathizerViewModel vmSympathizer) { if (!Authorized(Role.Volunteer)) { return(Unauthorized()); } if (ModelState.IsValid) { _context.Update(vmSympathizer.Sympathizer); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(vmSympathizer)); }
public IActionResult CreateSympathizer(SympathizerViewModel vmSympathizer) { if (!Authorized(Role.Volunteer)) { return(Unauthorized()); } if (ModelState.IsValid) { #region Creating Sympathizer string fileName = Configurations.DefaultImageFileName; //Setting value for creation vmSympathizer.Sympathizer.RegistrationDate = DateTime.Now; _context.Sympathizers.Add(vmSympathizer.Sympathizer); #endregion Creating Sympathizer _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(vmSympathizer)); }