public ActionResult Create([Bind(Include = "FriendID, Ime, MestoNaZiveenje")] FriendModel friend) { if (ModelState.IsValid) { db.FriendModels.Add(friend); db.SaveChanges(); return(RedirectToAction("ListAll")); } else { return(RedirectToAction("Create")); } }
public ActionResult Create(FriendModel model) { if (ModelState.IsValid) { _db.Friends.Add(model); _db.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } }