Пример #1
0
        public void Update(int articlePhotoId, ArticlePhotoModel articlePhoto)
        {
            var result = _context.ArticlePhotos.SingleOrDefault(x => x.ArticlePhotoId == articlePhotoId);

            if (result != null)
            {
                result.FileName = articlePhoto.FileName;
                _context.SaveChanges();
            }
        }
Пример #2
0
 public void Add(ArticlePhotoModel articlePhoto)
 {
     _context.ArticlePhotos.Add(articlePhoto);
     _context.SaveChanges();
 }
 public ActionResult Edit(int id, ArticlePhotoModel articlePhoto)
 {
     _articlePhotoRepository.Update(id, articlePhoto);
     return(RedirectToAction(nameof(Index)));
 }
 public ActionResult Delete(int id, ArticlePhotoModel articlePhoto)
 {
     _articlePhotoRepository.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }
 public ActionResult Create(ArticlePhotoModel articlePhoto)
 {
     _articlePhotoRepository.Add(articlePhoto);
     return(RedirectToAction(nameof(Index)));
 }