コード例 #1
0
        public async Task <IHttpActionResult> DeleteDoctorCategory(DoctorCategoryModel doctorCategory)
        {
            if (await DoctorCategoryService.DoctorCategoryExistsForUpdateAndDelete(doctorCategory.ID))
            {
                var doctorCategorytoDelete = new DoctorCategoryModel
                {
                    ID   = doctorCategory.ID,
                    Name = doctorCategory.Name
                };

                CommonResponse roleResponse = await DoctorCategoryService.DeleteDoctorCategory(doctorCategorytoDelete);

                if (roleResponse.IsError)
                {
                    return(BadRequest("Error In Deleting The Doctor Category!"));
                }
                else
                {
                    return(Ok("Doctor Category Deleting Successfully!"));
                }
            }
            else
            {
                return(BadRequest("Doctor Category Does Not Exist!!"));
            }
        }
コード例 #2
0
        public async Task <IHttpActionResult> AddDoctorCategory(DoctorCategoryModel doctorCategory)
        {
            if (await DoctorCategoryService.DoctorCategoryExists(doctorCategory.Name))
            {
                return(BadRequest("Doctor Category Already Exists"));
            }
            else
            {
                var doctorCategorytocreate = new DoctorCategoryModel
                {
                    Name = doctorCategory.Name
                };

                CommonResponse response = await DoctorCategoryService.AddNewDoctorCategory(doctorCategorytocreate);

                if (response.IsError)
                {
                    return(BadRequest("Error In Adding The New Doctor Category!"));
                }
                else
                {
                    return(Ok("Doctor Category Added Successfully!"));
                }
            }
        }
コード例 #3
0
        public async Task <IHttpActionResult> GetDoctorCategories()
        {
            var response = await DoctorCategoryService.GetDoctorCategories();

            if (response == null)
            {
                return(BadRequest("Error In Getting Doctor Categories!"));
            }
            else
            {
                return(Ok(response));
            }
        }