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!!")); } }
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!")); } } }
public async Task <IHttpActionResult> GetDoctorCategories() { var response = await DoctorCategoryService.GetDoctorCategories(); if (response == null) { return(BadRequest("Error In Getting Doctor Categories!")); } else { return(Ok(response)); } }