コード例 #1
0
        public ActionResult Select()
        {
            string mode = Request.QueryString["Grid-mode"];

            if (!string.IsNullOrEmpty(mode))
            {
                return(this.RedirectToAction("Create"));
            }
            else
            {
                List <ReligionVM> viewModels           = new List <ReligionVM>();
                ReligionBAL       balObject            = new ReligionBAL();
                IQueryable <Entities.Religion> entites = balObject.GetAll();

                foreach (Entities.Religion entity in entites)
                {
                    ReligionVM viewModel = new ReligionVM();
                    viewModel.ReligionId   = entity.ReligionId;
                    viewModel.ReligionName = entity.ReligionName;
                    viewModel.Status       = entity.Status;
                    viewModel.Remark       = entity.Remark;
                    viewModels.Add(viewModel);
                }
                return(this.View("Index", new GridModel <ReligionVM> {
                    Data = viewModels
                }));
            }
        }
コード例 #2
0
        /// <summary>
        /// method for get religions list
        /// </summary>
        /// <returns>religions list</returns>
        public JsonResult GetReligionsList()
        {
            ReligionBAL religionBAL   = new ReligionBAL();
            var         religionsList = from obj in religionBAL.GetAll().Where(c => c.Status == true) select new SelectListItem()
            {
                Text = obj.ReligionName, Value = obj.ReligionId.ToString()
            };

            return(this.Json(religionsList, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        //
        // GET: /SysAdmin/ReligionCast/Create
        public ActionResult Create()
        {
            ReligionCastVM viewModel = new ReligionCastVM();

            ReligionBAL ReligionBAL = new ReligionBAL();

            viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem()
            {
                Text = obj.ReligionName, Value = obj.ReligionId.ToString()
            };

            viewModel.Status = true;
            return(View(viewModel));
        }
コード例 #4
0
        public ActionResult Index()
        {
            List <ReligionVM> viewModels           = new List <ReligionVM>();
            ReligionBAL       balObject            = new ReligionBAL();
            IQueryable <Entities.Religion> entites = balObject.GetAll();

            foreach (Entities.Religion entity in entites)
            {
                ReligionVM viewModel = new ReligionVM();
                viewModel.ReligionId   = entity.ReligionId;
                viewModel.ReligionName = entity.ReligionName;
                viewModel.Status       = entity.Status;
                viewModel.Remark       = entity.Remark;
                viewModels.Add(viewModel);
            }
            return(View(new GridModel <ReligionVM> {
                Data = viewModels
            }));
        }
コード例 #5
0
        public ActionResult Create(ReligionCastVM viewModel)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    Entities.ReligionCast entity = new Entities.ReligionCast();
                    entity.ReligionCastId  = viewModel.ReligionCastId;
                    entity.ReligionId      = viewModel.ReligionId;
                    entity.CastId          = viewModel.CastId;
                    entity.ReserveCategory = viewModel.ReserveCategory;
                    entity.Status          = viewModel.Status;
                    entity.Remark          = viewModel.Remark;

                    ReligionCastBAL balObject = new ReligionCastBAL();
                    balObject.Add(entity);
                    //this.TempData["AlertMessage"] = "Successfully Save !!!";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ReligionBAL ReligionBAL = new ReligionBAL();
                    viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem()
                    {
                        Text = obj.ReligionName, Value = obj.ReligionId.ToString()
                    };
                    return(View(viewModel));
                }
            }
            catch
            {
                ReligionBAL ReligionBAL = new ReligionBAL();
                viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem()
                {
                    Text = obj.ReligionName, Value = obj.ReligionId.ToString()
                };
                return(View(viewModel));
            }
        }
コード例 #6
0
        public ActionResult Edit(ReligionCastVM viewModel)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    Entities.ReligionCast entity = new Entities.ReligionCast();
                    entity.ReligionCastId  = viewModel.ReligionCastId;
                    entity.ReligionId      = viewModel.ReligionId;
                    entity.CastId          = viewModel.CastId;
                    entity.ReserveCategory = viewModel.ReserveCategory;
                    entity.Status          = viewModel.Status;
                    entity.Remark          = viewModel.Remark;

                    ReligionCastBAL balObject = new ReligionCastBAL();
                    balObject.Edit(entity);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ReligionBAL ReligionBAL = new ReligionBAL();
                    viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem()
                    {
                        Text = obj.ReligionName, Value = obj.ReligionId.ToString()
                    };
                    return(View(viewModel));
                }
            }
            catch
            {
                ReligionBAL ReligionBAL = new ReligionBAL();
                viewModel.Religions = from obj in ReligionBAL.GetAll() select new SelectListItem()
                {
                    Text = obj.ReligionName, Value = obj.ReligionId.ToString()
                };
                return(View());
            }
        }