Exemplo n.º 1
0
 public ActionResult CreateRole(tbl_MCE_Role mce_role)
 {
     _role.AddRole(mce_role);
     TempData["Success"] = "Data Inserted Successfully";
     ModelState.Clear();
     return(View());
 }
Exemplo n.º 2
0
        public ActionResult <Role> AddRole(Role role)
        {
            var verifiLibelle = _roleData.GetRoleByLibelle(role.Libelle);

            if (verifiLibelle == null)
            {
                _roleData.AddRole(role);
                _roleData.SaveChanges();

                return(CreatedAtRoute(nameof(GetRoleById), new { Id = role.Id }, role));
            }
            else
            {
                return(NotFound($"Un role avec le libelle : {role.Libelle} existe déjà"));
            }
        }
Exemplo n.º 3
0
        public ActionResult <Role> AddRole([FromBody] Role value)
        {
            Task <Role> data = role.AddRole(value);

            if (data.IsCanceled)
            {
                return(BadRequest(data.Exception));
            }
            else if (data.Result == null)
            {
                return(NoContent());
            }
            else
            {
                return(Ok(data.Result));
            }
        }
Exemplo n.º 4
0
        public ActionResult Create(Registration registration)
        {
            var isEmailExist = Iregistration.CheckEmailExists(registration.Email);

            if (isEmailExist)
            {
                ModelState.AddModelError("", errorMessage: "Email Already used!! Try Unique One");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    Iregistration.AddUser(registration);

                    int userid = databaseContext.Registrations.Max(x => x.UserId);
                    Irole.AddRole(userid);

                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View());
        }
Exemplo n.º 5
0
 public bool AddRole(Roles role)
 {
     return(dll.AddRole(role));
 }
Exemplo n.º 6
0
 public void AddRole(Role r)
 {
     RoleInterface.AddRole(r);
 }