public void Create(News news) { try { var mapNews = AutoMapper.Mapper.Map <Data.Entities.News>(news); _newsRepository.Add(mapNews); _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }
public void Update(News news) { try { var mapNews = AutoMapper.Mapper.Map <Data.Entities.News>(news); var actualNews = _newsRepository .FindBy(n => n.Id == mapNews.Id) .First(); actualNews.EmployeeId = mapNews.EmployeeId; actualNews.Content = mapNews.Content; actualNews.Title = mapNews.Title; actualNews.CreateDate = DateTime.Now; _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }