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 Confirm(int id) { using (var collectService = new CollectsService()) { var collectViewModel = collectService.GetCollectViewModel(id, GetUserId()); using (var userService = new UsersService()) { if (!userService.IsAdmin(GetUserId())) { if (!collectService.IsCollectionsUser(id, GetUserId())) { return(HttpNotFound()); } } } if (collectService.CounterCollectionsGifts(id) == 0) { ViewBag.MustChooseItem = "Musisz wybrać któryś z prezentów !"; } return(View(collectViewModel)); } }
public ActionResult Leave(int id) { using (var collectService = new CollectsService()) { var collectViewModel = collectService.GetCollectViewModel(id, GetUserId()); return(View(collectViewModel)); } }
public ActionResult Details(int id) { using (var collectService = new CollectsService()) { ViewBag.InCollect = collectService.IsCollectionsUser(id, GetUserId()); 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)); } }