public async Task <int> Create(CreateBrochureViewModel item) { var createdItem = Mapper.Map <CreateBrochureViewModel, Brochure>(item); int createdItemId = await _brochureRepository.Create(createdItem); return(createdItemId); }
public void Create(BrochureViewModel brochureViewModel) { var brochure = Mapper.Map <BrochureViewModel, Brochure>(brochureViewModel); brochure.Type = LibraryType.Brochures; _brochureRepository.Create(brochure); }
public void Create(BrochureViewModel brochureViewModel, HttpPostedFileBase uploadImage) { var brochure = Mapper.Map <BrochureViewModel, Brochure>(brochureViewModel); brochure.Type = LibraryType.Brochures; IEnumerable <Redaction> redactions = _redactionRepository.GetAll(); brochure.RedactionName = redactions.FirstOrDefault(x => x.RedactionId == brochure.RedactionId)?.RedactionName; byte[] imageData = _imageHelper.GetImage(uploadImage); brochure.Image = imageData; _brochureRepository.Create(brochure); }