public DomainListContract<ViewRatingTypeContract> SaveAllViewRatingTypes(DomainListContract<ViewRatingTypeContract> contract) { try { using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString)) { var provider = new ViewRatingTypeDal(context); var process = new ViewRatingTypeProcess(provider); var service = new ViewRatingTypeService(process); var domainList = new ViewRatingType().ConvertToDomain<ViewRatingType, IEnumerable<ViewRatingType>, ViewRatingTypeContract>(contract); var result = service.SaveAll(domainList); var returnResult = new ViewRatingType().ConvertToContract<ViewRatingType, IEnumerable<ViewRatingType>, ViewRatingTypeContract>(result); return returnResult; } } catch (Exception exception) { return HandleExceptionResponse<ViewRatingTypeContract>(exception); } }
public ViewRatingTypeContract SaveViewRatingType(ViewRatingTypeContract contract) { try { using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString)) { var provider = new ViewRatingTypeDal(context); var process = new ViewRatingTypeProcess(provider); var service = new ViewRatingTypeService(process); var result = service.Save(new ViewRatingType(contract)); var returnResult = new ViewRatingType().ConvertToContract(result, new ViewRatingTypeContract()); return returnResult; } } catch (Exception exception) { return HandleExceptionResponse<ViewRatingType, ViewRatingTypeContract>(exception); } }
public DomainStatusContract RemoveViewRatingType(int id) { try { using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString)) { var provider = new ViewRatingTypeDal(context); var process = new ViewRatingTypeProcess(provider); var service = new ViewRatingTypeService(process); var result = service.Remove(id); return DomainStatus.ConvertToContract(result); } } catch (Exception exception) { return HandleExceptionResponse(exception); } }