示例#1
0
        public async Task <IActionResult> UpdateStatus(int id, short isActive)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = "Invalid Model State";
                return(BadRequest(objHelper));
            }
            try
            {
                await Email_ConRepo.ToogleStatus(id, isActive);

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

                return(Ok(objHelper));
            }
            catch
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = "Save Unsuccessful";
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
        public async Task <IActionResult> UpdateStatus(int id, short isActive)
        {
            ResponseHelper objHelper = new ResponseHelper();

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

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

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