예제 #1
0
        public async Task <IActionResult> Get(int id)
        {
            ResponseHelper objHelper = new ResponseHelper();

            try
            {
                var vList = await Module_PermissionRepo.Get(id);

                if (vList == null)
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Get Empty Data";
                }
                else
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Get Successfully";
                    objHelper.Data    = vList;
                }
                return(Ok(objHelper));
            }
            catch
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = "Get Unsuccessful";
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
예제 #2
0
        public async Task <IActionResult> Get(int id)
        {
            ResponseHelper objHelper = new ResponseHelper();

            try
            {
                var vList = await Module_PermissionRepo.Get(id);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Get Successfully";
                objHelper.Data    = vList;

                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
예제 #3
0
        public async Task <IActionResult> UpdateStatus(int id, short isActive)
        {
            ResponseHelper objHelper = new ResponseHelper();

            try
            {
                await Module_PermissionRepo.ToogleStatus(id, isActive);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                objHelper.Data    = await Module_PermissionRepo.Get(id);

                return(Ok(objHelper));
            }
            catch (Exception ex)
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }