public ActionResult AddContent(AddContentForm form) { if (ModelState.IsValid) { _frigoRepository.Insert(new Content(form.ProductId, form.AddedDate, form.ExpirationDate, SessionManager.User.Id)); form = new AddContentForm(); //pour la redirection ViewBag.Added = true; } //recharger la liste des produits form.Products = new List <SelectListItem>(_productRepository.Get(SessionManager.User.Id).Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() })); return(PartialView("_AddContent", form)); }
public bool Insert(Content entity) { return(_globalRepository.Insert(entity.ToGlobal())); }