Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            OwnModel ownModel = db.Owns.Find(id);

            db.Owns.Remove(ownModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Create(OwnModel ownModel)
        {
            if (ModelState.IsValid)
            {
                ownModel.Id = Guid.NewGuid();
                db.Owns.Add(ownModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ownModel));
        }
Ejemplo n.º 3
0
        // GET: Own/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OwnModel ownModel = db.Owns.Find(id);

            if (ownModel == null)
            {
                return(HttpNotFound());
            }
            return(View(ownModel));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(FormCollection form)
        {
            OwnModel ownModel = new OwnModel();

            if (!TryUpdateModel <OwnModel>(ownModel))
            {
                return(View());
            }
            if (ModelState.IsValid)
            {
                db.Entry(ownModel).State = EntityState.Modified;
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }
            if (form["btn1"] != null)
            {
                return(View());
            }
            else if (form["btn2"] != null)
            {
                return(View());
            }
            return(View());
        }