public HttpResponseMessage DeleteNarrationInformation(NarrationInformationModel model) { IUnitOfWork uWork = new UnitOfWork(); INarrationInformationRepository narrationInformation = new NarrationInformationRepository(uWork); INarrationInformationService narrationInformationService = new NarrationInformationService(narrationInformation); try { if (this.ModelState.IsValid) { var result = narrationInformationService.DeleteNarrationInformation(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 GetNarrationInformationModels(BaseViewModel model) { IUnitOfWork uWork = new UnitOfWork(); INarrationInformationRepository narrationInformation = new NarrationInformationRepository(uWork); INarrationInformationService narrationInformationService = new NarrationInformationService(narrationInformation); try { if (this.ModelState.IsValid) { var narrationInformationList = narrationInformationService.GetAllNarrationInformationList(model); if (narrationInformationList != null) { return(Request.CreateResponse(HttpStatusCode.OK, narrationInformationList)); } 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)); } }