Пример #1
0
        public ActionResult DeleteFrequentFlyer(int id)
        {
            var       modelCaller = new ModelInitialize(db);
            var       model       = modelCaller.EditFlyerDetail().FirstOrDefault(x => x.TravellerID == id);
            MayFlower checkDb     = new MayFlower();

            foreach (var group in checkDb.TravellerGroups.Where(x => x.IsActive == true))
            {
                if (group.TravellerID == model.TravellerID)
                {
                    ModelState.AddModelError("Error", "This frequent traveller " + model.FullName + " added in Traveller Group!");
                    TempData["ModelStateDeleteError"] = ModelState;
                    return(RedirectToAction("FrequentFlyer", "Tools", ModelState));
                    //throw new Exception("This frequent traveller added in traveller group!");
                }
            }
            model.IsActive = false;

            SqlCommand command = new SqlCommand();

            MemberServiceController.EditFrequentFlyer(id, CurrentUserID, model, command);
            command.Transaction.Commit();

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(RedirectToAction("FrequentFlyer", "Tools"));
        }
Пример #2
0
        public ActionResult EditFrequentFlyer(int id, FrequentFlyerEditModel model)
        {
            SqlCommand command = new SqlCommand();

            model.IsActive = true;
            MemberServiceController.EditFrequentFlyer(id, CurrentUserID, model, command);
            command.Transaction.Commit();
            return(RedirectToAction("FrequentFlyer", "Tools"));
        }