public ActionResult Index(FormAlertViewModel model) { if (!ModelState.IsValid) { return(View(model)); } TempData["FormSuccess"] = "New alert has been reported successfully!"; alertManager.Add(model); return(RedirectToAction("Index")); }
public void Add(FormAlertViewModel model) { User dbUser = unitOfWork.UserRepository.Get(SessionParser.User.Id); Alert alert = new Alert { AlertType = model.AlertType, User = dbUser, DateRow = DateTime.Now, Message = model.Message, Title = model.Title }; unitOfWork.AlertRepository.Add(alert); }