public HttpResponseMessage DeleteNarrationVoiceFile(NarrationVoiceFilesModel model) { IUnitOfWork uWork = new UnitOfWork(); INarrationVoiceFilesRepository narrationVoiceFilesRepository = new NarrationVoiceFilesRepository(uWork); INarrationVoiceFilesService narrationVoiceFilesService = new NarrationVoiceFilesService(narrationVoiceFilesRepository); try { if (this.ModelState.IsValid) { var result = narrationVoiceFilesService.DeleteNarrationVoiceFile(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 GetNarrationVoiceFileModels(BaseViewModel model) { IUnitOfWork uWork = new UnitOfWork(); INarrationVoiceFilesRepository narrationVoiceFilesRepository = new NarrationVoiceFilesRepository(uWork); INarrationVoiceFilesService narrationVoiceFilesService = new NarrationVoiceFilesService(narrationVoiceFilesRepository); try { if (this.ModelState.IsValid) { var narrationVoiceFileList = narrationVoiceFilesService.GetAllNarrationVoiceFileList(model); if (narrationVoiceFileList != null) { return(Request.CreateResponse(HttpStatusCode.OK, narrationVoiceFileList)); } 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)); } }