Beispiel #1
0
        public ActionResult Delete(int?commercialCourtPK)
        {
            ICommercialCourtsRepository commercialCourtsRepository = new CommercialCourtsRepository(db);

            if (commercialCourtPK != null)
            {
                CommercialCourt commercialCourt = commercialCourtsRepository.GetCommercialCourtByPK((int)commercialCourtPK);

                commercialCourt.Deleted = true;

                commercialCourtsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", commercialCourt.CommercialCourtPK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Beispiel #2
0
        public ActionResult Edit(CommercialCourtView commercialCourtModel)
        {
            if (ModelState.IsValid)
            {
                ICommercialCourtsRepository commercialCourtsRepository = new CommercialCourtsRepository(db);
                CommercialCourt             commercialCourt            = commercialCourtsRepository.GetCommercialCourtByPK((int)commercialCourtModel.CommercialCourtPK);
                commercialCourtModel.ConvertTo(commercialCourtModel, commercialCourt);

                commercialCourtsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", commercialCourt.CommercialCourtPK);

                return(RedirectToAction("Index", "CommercialCourt"));
            }
            else
            {
                return(View(commercialCourtModel));
            }
        }
Beispiel #3
0
        public ActionResult Add(CommercialCourtView commercialCourtView)
        {
            if (ModelState.IsValid)
            {
                ICommercialCourtsRepository commercialCourtsRepository = new CommercialCourtsRepository(db);
                CommercialCourt             commercialCourt            = new CommercialCourt();

                commercialCourtView.ConvertTo(commercialCourtView, commercialCourt);

                commercialCourtsRepository.Add(commercialCourt);
                commercialCourtsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", commercialCourt.CommercialCourtPK);

                return(RedirectToAction("Index", "CommercialCourt"));
            }
            else
            {
                return(View(commercialCourtView));
            }
        }