Example #1
0
        public ActionResult Detail(int?id, Roles model, List <int> idsModul)
        {
            RolRepository      objrol      = new RolRepository(SessionCustom);
            RolmodulRepository objrolmodul = new RolmodulRepository(SessionCustom);

            objrol.Entity = model.RolCustom;

            if (id != null)
            {
                objrolmodul.Entity.RolId = objrol.Entity.RolId = id;
                objrol.Update();
                objrolmodul.Delete();
                this.InsertAudit("Update", this.Module.Name + " -> " + objrol.Entity.Name);
            }
            else
            {
                objrolmodul.Entity.RolId = Convert.ToInt32(objrol.Insert());
                this.InsertAudit("Insert", this.Module.Name + " -> " + objrol.Entity.Name);
            }

            if (idsModul != null)
            {
                foreach (int item in idsModul)
                {
                    objrolmodul.Entity.ModulId = item;
                    objrolmodul.Insert();
                }
            }

            return(this.RedirectToAction("Index", "Roles"));
        }
Example #2
0
        /// <summary>
        /// obtains the role detail
        /// </summary>
        /// <param name="id">identifier of role</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            RolRepository      objrol      = new RolRepository(SessionCustom);
            ModulRepository    objmod      = new ModulRepository(SessionCustom);
            RolmodulRepository objrolmodul = new RolmodulRepository(SessionCustom);

            objmod.Entity.LanguageId = CurrentLanguage.LanguageId.Value;
            Domain.Entities.Rol rol = null;

            if (id != null)
            {
                objrolmodul.Entity.RolId = objrol.Entity.RolId = id;
                objrol.Load();
                rol        = objrol.Entity;
                ViewBag.id = id;
            }

            return(this.View(new Roles()
            {
                UserPrincipal = CustomUser,
                Module = this.Module,
                RolCustom = rol,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                CollModuls = objmod.GetAllReadOnly(),
                CollRolmodul = id != null ? objrolmodul.GetAllReadOnly() : null,
                CurrentLanguage = CurrentLanguage
            }));
        }