// GET: OperatorCentru public ActionResult Index() { var op = new OperatorCentru(); op.Adresa = "piata unirii cluj"; ViewBag.op = op; return(View(db.OperatorCentru.ToList())); }
public ActionResult DeleteConfirmed(int id) { OperatorCentru operatorCentru = db.OperatorCentru.Find(id); db.OperatorCentru.Remove(operatorCentru); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id_Operator,Adresa")] OperatorCentru operatorCentru) { if (ModelState.IsValid) { db.Entry(operatorCentru).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(operatorCentru)); }
public ActionResult Create([Bind(Include = "Id_Operator,Adresa")] OperatorCentru operatorCentru) { if (ModelState.IsValid) { db.OperatorCentru.Add(operatorCentru); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(operatorCentru)); }
// GET: OperatorCentru/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OperatorCentru operatorCentru = db.OperatorCentru.Find(id); if (operatorCentru == null) { return(HttpNotFound()); } return(View(operatorCentru)); }
public ActionResult Register(Utilizator model) { var ConfirmareParola = Request.Form["pwd"]; if (ModelState.IsValid && (model.Parola.Equals(ConfirmareParola))) { var PAROLA = SHA1.Create().ComputeHash(Encoding.UTF8.GetBytes(model.Parola)); model.Parola = BitConverter.ToString(PAROLA).Replace("-", "").ToLower(); if (model.Functie == "Operator") { model.Functie = "OperatorCentru"; } // Attempt to register the user try { db.Utilizator.Add(model); db.SaveChanges(); if (model.Functie == "Medic") { var Spital = Request.Form["Spital"]; var medic = new Medic(); medic.Spital = Spital; medic.Utilizator = model; db.Medic.Add(medic); db.SaveChanges(); } else if (model.Functie == "OperatorCentru") { var AdresaCentru = Request.Form["AdresaCentru"]; var operatorCentru = new OperatorCentru(); operatorCentru.Adresa = AdresaCentru; operatorCentru.Utilizator = model; db.OperatorCentru.Add(operatorCentru); db.SaveChanges(); } return(RedirectToAction("Index")); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", e.StatusCode.ToString()); } } // If we got this far, something failed, redisplay form return(View(model)); }