public ActionResult Edit([Bind(Include = "UserId,Nick,UserName,Password,Role,Company,Comment,Active,FirstCreated,LastLogin,Email")] SystemUser systemUser) { if (ModelState.IsValid) { db.Entry(systemUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(systemUser)); }
public ActionResult Edit(Transaction Transaction) //[Bind(Include = "TransactionID,CompanyId,TransactionType,TransactionDate,In,Out,ResponsiblePerson,Comment,Active")] { if (ModelState.IsValid) { if (Transaction == null | Session["UserID"] == null) { return(RedirectToAction("Login", "Login")); } else { if (Transaction.ResponsiblePerson == Prenosna.DajJuzerAjDi(Session["UserID"])) { bool Udri = true; if (Transaction.TransactionType == PrevodSrb.Produkcija) { if (Transaction.Amount > 0) { } else { TempData["msg"] = "Ako upisujete transakciju produkcija, mora da se unese iznos koji je veći od nule"; return(RedirectToAction("Index")); } } Transaction.TransactionDate = Prenosna.StariDatum; if (Udri) { db.Entry(Transaction).State = EntityState.Modified; } else { db.Transactions.Add(Transaction); } // db.Entry(Transaction).State = EntityState.Modified; Prenosna.SnimiDb(db); return(RedirectToAction("Index")); } else { TempData["msg"] = Prenosna.Poruka(PrevodSrb.Ne_mogu_se_menjati_unosi_drugog_korisnika_); } } } ViewBag.ListaSelekta = ListaSelekta; //ViewBag.ResponsiblePerson = new SelectList(db.SystemUsers, "UserId", "Nick", Transaction.ResponsiblePerson); return(View(Transaction)); }