public HttpResponseMessage DeleteStaffNarrationType(StaffNarrationTypeModel model) { IUnitOfWork uWork = new UnitOfWork(); IStaffNarrationTypeRepository staffNarrationType = new StaffNarrationTypeRepository(uWork); IStaffNarrationTypeService staffNarrationTypeService = new StaffNarrationTypeService(staffNarrationType); try { if (this.ModelState.IsValid) { var result = staffNarrationTypeService.DeleteStaffNarrationType(model); if (result != null) { return(Request.CreateResponse(HttpStatusCode.OK, result)); } else { string message = "Not deleted successfully"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public HttpResponseMessage GetStaffNarrationTypeModels(BaseViewModel model) { IUnitOfWork uWork = new UnitOfWork(); IStaffNarrationTypeRepository staffNarrationType = new StaffNarrationTypeRepository(uWork); IStaffNarrationTypeService staffNarrationTypeService = new StaffNarrationTypeService(staffNarrationType); try { if (this.ModelState.IsValid) { var staffNarrationTypeList = staffNarrationTypeService.GetAllStaffNarrationTypeList(model); if (staffNarrationTypeList != null) { return(Request.CreateResponse(HttpStatusCode.OK, staffNarrationTypeList)); } else { string message = "Error in getting Data"; return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message)); } } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message)); } }