Exemplo n.º 1
0
        public ActionResult Save(PartyModel partyModel)
        {
            bool status = false;

            try
            {
                if (ModelState.IsValid)
                {
                    Services.PartyServiceClient service = new Services.PartyServiceClient();
                    status = service.SaveData(partyModel);

                    //ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", customers.iCountry);
                    //ViewBag.City = new SelectList(db.MCities, "iCity", "strCityName", customers.iCity);


                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }
            return(View(partyModel));
            // return new JsonResult { Data = new { status = status } };
        }
Exemplo n.º 2
0
        public ActionResult Save(int id)
        {
            PartyModel party = new PartyModel();

            try
            {
                if (ModelState.IsValid)
                {
                    Services.PartyServiceClient service = new Services.PartyServiceClient();
                    party           = service.GetParty(id);
                    ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", party.iCountry);
                    var countryList = db.MCities.Where(x => x.iCountry == party.iCountry).ToList();

                    ViewBag.City     = new SelectList(countryList, "iCity", "strCityName", party.iCity);
                    ViewBag.PageName = "Create Party";
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "something went wrong");
                party = null;
                throw e;
            }
            return(View(party));
        }
Exemplo n.º 3
0
        public ActionResult GetAllParties()
        {
            dynamic party = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    Services.PartyServiceClient service = new Services.PartyServiceClient();

                    party = service.GetAllParties();
                    //if (customer.Count == 0 || customer == null)
                    //{
                    //    ModelState.AddModelError("error", "No Record Found");
                    //}
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                party = null;
                throw e;
            }
            return(Json(party, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult Delete(int id)
        {
            PartyModel partyModel = new PartyModel();

            try
            {
                if (ModelState.IsValid)
                {
                    Services.PartyServiceClient service = new Services.PartyServiceClient();

                    partyModel      = service.GetParty(id);
                    ViewBag.Country = new SelectList(db.MCountries, "iCountry", "strCountryName", partyModel.iCountry);
                    var countryList = db.MCities.Where(x => x.iCountry == partyModel.iCountry).ToList();

                    ViewBag.City = new SelectList(countryList, "iCity", "strCityName", partyModel.iCity);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                partyModel = null;
                throw e;
            }
            //return View("Save", customer);
            return(View(partyModel));
        }
Exemplo n.º 5
0
        public ActionResult DeleteCustomers(int id)
        {
            bool status = false;

            try
            {
                if (ModelState.IsValid)
                {
                    Services.PartyServiceClient service = new Services.PartyServiceClient();
                    status = service.Delete(id);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong!");
                status = false;
                throw e;
            }
            return(View("Index"));
            // return new JsonResult { Data = new { status = status } };
        }