public Response <DtoBuncisNews> BPInsertNews(int clientId, DtoBuncisNews news) { var service = IoC.Resolve <INewsService>(); var viewModel = new ViewModelNewsItem().InjectFrom <CloneInjection>(news) as ViewModelNewsItem; var result = service.SaveNewsItem(clientId, viewModel); var response = new Response <DtoBuncisNews>(); response.IsSuccess = result.IsValid; response.Message = result.ValidationSummaryToString(); if (response.IsSuccess) { var responseObject = new DtoBuncisNews().InjectFrom <CloneInjection>(result.RelatedObject) as DtoBuncisNews; response.ResponseObject = responseObject; } return(response); }
public Response <IEnumerable <DtoBuncisNews> > GetPublishedNewsList(int clientId) { var newsService = IoC.Resolve <INewsService>(); var raw = newsService.GetPublishedNewsItem(clientId); var converted = raw.Select(o => { var dto = new DtoBuncisNews(); dto.InjectFrom <CloneInjection>(o); return(dto); }).ToList(); var response = new Response <IEnumerable <DtoBuncisNews> >(); response.IsSuccess = true; response.Message = string.Empty; response.ResponseObject = converted; return(response); }