public ActionResult SaveEdition(EditAddViewModel editAddViewModel)
        {
            if (!ModelState.IsValid)
            {
                EditAddViewModel newEditAddViewModel = new EditAddViewModel
                {
                    Categories = context.Categories.ToList()
                };
                return(View("Edit", newEditAddViewModel));
            }

            var addInDbContext = context.Adds.Include(a => a.Article)
                                 .SingleOrDefault(a => a.ArticleId == editAddViewModel.Add.ArticleId);

            addInDbContext.Article.Name        = editAddViewModel.Add.Article.Name;
            addInDbContext.Article.Brand       = editAddViewModel.Add.Article.Brand;
            addInDbContext.Article.Price       = editAddViewModel.Add.Article.Price;
            addInDbContext.Article.Description = editAddViewModel.Add.Article.Description;
            addInDbContext.Article.Category    = editAddViewModel.Add.Article.Category;
            addInDbContext.Article.IsNew       = editAddViewModel.Add.Article.IsNew;

            addInDbContext.Amount       = editAddViewModel.Add.Amount;
            addInDbContext.Description  = editAddViewModel.Add.Description;
            addInDbContext.LastModified = DateTime.Today;

            context.SaveChanges();
            return(RedirectToAction("MyAdds", "Add"));
        }
        public ActionResult Edit(int aid, string uid)
        {
            var add = context.Adds.Include(a => a.Article).SingleOrDefault(a => a.ArticleId == aid && a.UserId == uid);

            if (add == null)
            {
                return(RedirectToAction("Index"));
            }

            var viewModel = new EditAddViewModel
            {
                Add        = add,
                Categories = context.Categories.ToList()
            };

            return(View(viewModel));
        }