Beispiel #1
0
 public HttpResponseMessage Get()
 {
     try
     {
         var Role = _roleServices.GetAllRoles();
         return(Request.CreateResponse(HttpStatusCode.OK, Role));
     }
     catch (Exception ex)
     {
         throw new ApiDataException(1000, "Role Not Found", HttpStatusCode.NotFound);
     }
 }
        public IEnumerable <RoleEntity> GetAllRoles()

        {
            var roleEntities = roleServices.GetAllRoles();

            if (roleEntities != null)
            {
                if (roleEntities.Any())
                {
                    return(roleEntities);
                }
            }
            return(null);
        }
        public IEnumerable <RoleViewModel> GetAllRoles()

        {
            var roleEntities = roleServices.GetAllRoles();

            if (roleEntities != null)
            {
                if (roleEntities.Any())
                {
                    Mapper.Initialize(cfg => cfg.CreateMap <RoleEntity, RoleViewModel>());
                    var roles = Mapper.Map <IEnumerable <RoleEntity>, IEnumerable <RoleViewModel> >(roleEntities);
                    return(roles);
                }
            }
            return(null);
        }
Beispiel #4
0
        // GET: DisplayMenu
        public ActionResult Index()
        {
            var lstRole = _roleServices.GetAllRoles();

            return(View(lstRole));
        }
Beispiel #5
0
 public JsonResult GetAllRoles()
 {
     return(Json(_roleServices.GetAllRoles(), JsonRequestBehavior.AllowGet));
 }