public void Add(PostMagazineViewModel magazineView) { Magazine magazine = Mapper.Map <PostMagazineViewModel, Magazine>(magazineView); magazine.PublicationType = PublicationType.Magazine; _magazineRepository.Add(magazine); }
public IActionResult Put(int id, [FromBody] PostMagazineViewModel magazine) { if (ModelState.IsValid) { _magazineService.Edit(magazine); return(Ok(magazine)); } return(BadRequest(ModelState)); }
private Magazine ToMagazine(PostMagazineViewModel magazineViewModel) { return(Mapper.Map <PostMagazineViewModel, Magazine>(magazineViewModel)); }
public void Edit(PostMagazineViewModel magazineViewModel) { _magazineRepository.Update(ToMagazine(magazineViewModel)); }
public void Add(PostMagazineViewModel magazineViewModel) { _magazineRepository.Add(ToMagazine(magazineViewModel)); }
public IActionResult Post([FromBody] PostMagazineViewModel magazine) { _magazineService.Add(magazine); return(Ok()); }