public ActionResult Edit(FormCollection echipmodel)
        {
            if (ModelState.IsValid)
            {
                tip_echipament s;
                long? id = long.Parse(echipmodel["id"]);
                if (id == -1)
                {
                    s = new tip_echipament();
                    s.denumire = echipmodel["denumire"].ToString();
                    db.AddTotip_echipament(s);
                    db.SaveChanges();
                }
                else
                {
                    s = db.tip_echipament.Where(o => o.id == id).FirstOrDefault();
                    s.denumire = echipmodel["denumire"].ToString();
                    db.SaveChanges();
                }

                int judetID = int.Parse(echipmodel["judetID"].ToString());

                var numejudet = (from j in db.judetes where j.id == judetID select j.denumire).FirstOrDefault();
                string tip_tree = s.id.ToString() + "_tip_echipament_" + echipmodel["siteID"].ToString() + "_" + echipmodel["judetID"].ToString();
                return RedirectToAction("Index", "Judete", new { name = numejudet, id = tip_tree });
            }
            else
            {
                return Json("Salvarea nu a fost efectuata!");
            }
        }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tip_echipament EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotip_echipament(tip_echipament tip_echipament)
 {
     base.AddObject("tip_echipament", tip_echipament);
 }
Пример #3
0
 /// <summary>
 /// Create a new tip_echipament object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="denumire">Initial value of the denumire property.</param>
 public static tip_echipament Createtip_echipament(global::System.Int32 id, global::System.String denumire)
 {
     tip_echipament tip_echipament = new tip_echipament();
     tip_echipament.id = id;
     tip_echipament.denumire = denumire;
     return tip_echipament;
 }