예제 #1
0
        public void Add(PostMagazineViewModel magazineView)
        {
            Magazine magazine = Mapper.Map <PostMagazineViewModel, Magazine>(magazineView);

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