Beispiel #1
0
        public async Task <Response <PaginationSet <HospitalModel> > > GetActiveHospitalAsync(int pageIndex, int pageSize)
        {
            HospitalStatus[] status = new HospitalStatus[] { HospitalStatus.Active };
            var response            = await FindHospitalByFilterAsync(pageIndex, pageSize, 0, String.Empty, status);

            return(response);
        }
Beispiel #2
0
        public async Task <IActionResult> ChangeHospitalStatus(int id, [FromBody] HospitalStatus status)
        {
            var result = await _hospitalService.ChangeHospitalStatusAsync(id, status);

            if (result.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }
Beispiel #3
0
        public async Task <Response <HospitalModel> > ChangeHospitalStatusAsync(int id, HospitalStatus status)
        {
            var response = InitErrorResponse();

            if (IsSuperAdmin())
            {
                var en = await _unitOfWork.HospitalRepository.GetSingleAsync(id);

                int userId = this.GetUserId();
                if (en != null)
                {
                    en.Status      = status;
                    en.UpdatedById = userId;
                    en.UpdatedDate = DateTime.UtcNow;
                    _unitOfWork.HospitalRepository.Edit(en);
                    _unitOfWork.Commit();
                    response      = InitSuccessResponse(MessageConstant.Update);
                    response.Item = GetModelFromEntity(en);
                }
                else
                {
                    response.Message = MessageConstant.NotFound;
                }
            }
            else
            {
                response.Message = MessageConstant.UserNotAllowed;
            }


            return(response);
        }