Exemple #1
0
 public void AddGenre(GenreDto dto)
 {
     Genre entity = new Genre();
     entity.Name = dto.Name;
     _genreRepository.Add(entity);
     _genreRepository.Save();
 }
Exemple #2
0
        //shto prima GenreDto dto ( clasa )
        public void AddGenre(GenreDto dto)
        {
            if(string.IsNullOrEmpty(dto.Name))          //na tuka moze nekakva logika da se stava
            {
                throw new Exception ("Name cannot be found");
            }

            // vo ovoj del se polni Genre vid na modelot
            Genre entity = new Genre();
            entity.Name = dto.Name;

            _genreRepository.Add(entity);
            _genreRepository.Save();
        }
 public ActionResult Add(GenreDto model)
 {
     _genreService.AddGenre(model);
     return RedirectToAction("Index");
 }