public IActionResult MainAdd(string dropDownUsers, string dropDownOffences, string description) { Main model = new Main(); if (dropDownUsers != null && dropDownOffences != null) { model.UserId = Int32.Parse(dropDownUsers); model.OffenceId = Int32.Parse(dropDownOffences); model.Description = description; model.Owner = User.Identity.Name; model.Date = DateTime.Now; userRepository.ChangeRating(userRepository.GetById(model.UserId), offenceRepository.GetById(model.OffenceId)); mainRepository.SaveMain(model); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public IActionResult MainAdd(string dropDownUsers, string dropDownOffences, string description) { Main model = new Main(); if (dropDownUsers != null && dropDownOffences != null) { model.UserId = Int32.Parse(dropDownUsers); model.OffenceId = Int32.Parse(dropDownOffences); model.Description = description; model.Owner = User.Identity.Name; model.Date = DateTime.UtcNow; userRepository.ChangeRating(userRepository.GetById(model.UserId), offenceRepository.GetById(model.OffenceId)); mainRepository.SaveMain(model); AddEventLog("Main", String.Format("Add Main - {0} : {1}. {2}", userRepository.GetById(model.UserId).Account, offenceRepository.GetById(model.OffenceId).Name, description)); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }