コード例 #1
0
        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));
            }
        }
コード例 #2
0
 public ActionResult Delete(int id)
 {
     using (var collectService = new CollectsService())
         return(View(collectService.GetCollect(id)));
 }