public ActionResult Confirm(int id, string uniqueRadio, string fname, CollectViewModel model) { using (var collectService = new CollectsService()) { try { int selectedId = Int32.Parse(model.Gift.Id); if (ModelState.IsValid) { collectService.ChangeRadioButtonChoose(id, GetUserId(), model.Gift.Id); } collectService.CollectAmountChange(id, model.Amount); collectService.CollectConfirmChange(id, true); //Send Email using (var userService = new UsersService()) { var collect = collectService.GetCollect(id); collectService.SendEmailsConfirm(userService.GetUserIndex().Where(i => i.Id != collect.RecipientId).ToList(), collect); } return(RedirectToAction("Details", "Collects", new { id = id })); } catch (NullReferenceException) { ViewBag.MustChooseItem = "Musisz wybrać jakikolwiek prezent !"; } var collectViewModel = collectService.GetCollectViewModel(id, GetUserId()); return(View(collectViewModel)); } }
public ActionResult Details(int id, CollectViewModel model) { using (var collectService = new CollectsService()) { ViewBag.InCollect = collectService.IsCollectionsUser(id, GetUserId()); if (ModelState.IsValid) { collectService.ChangeRadioButtonChoose(id, GetUserId(), model.Gift.Id); } var collectViewModel = collectService.GetCollectViewModel(id, GetUserId()); return(View(collectViewModel)); } }