public ActionResult Create(Equipment equipment) { if (ModelState.IsValid) { db.Equipment.AddObject(equipment); db.SaveChanges(); return RedirectToAction("Index"); } return View(equipment); }
/// <summary> /// Create a new Equipment object. /// </summary> /// <param name="equipmentId">Initial value of the EquipmentId property.</param> /// <param name="equipmentNumber">Initial value of the EquipmentNumber property.</param> /// <param name="model">Initial value of the Model property.</param> public static Equipment CreateEquipment(global::System.Int32 equipmentId, global::System.String equipmentNumber, global::System.String model) { Equipment equipment = new Equipment(); equipment.EquipmentId = equipmentId; equipment.EquipmentNumber = equipmentNumber; equipment.Model = model; return equipment; }
/// <summary> /// Deprecated Method for adding a new object to the Equipment EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEquipment(Equipment equipment) { base.AddObject("Equipment", equipment); }
public ActionResult Report(int equipmentId = 0) { Equipment equip = new Equipment(); equip = (from eq in db.Equipment select eq).Where(e => e.EquipmentId == equipmentId).FirstOrDefault(); var eqname = equip.EquipmentNumber + ' ' + equip.Model; var dailyfuellog = db.DailyFuelLog.Include("Equipment").Where(dfl => dfl.EquipmentId == equip.EquipmentId); ViewBag.eqName = eqname; if (dailyfuellog.Count() == 0) { ViewBag.noLogs = "No Logs To Display"; } return View(dailyfuellog.ToList()); }
public ActionResult Edit(Equipment equipment) { if (ModelState.IsValid) { db.Equipment.Attach(equipment); db.ObjectStateManager.ChangeObjectState(equipment, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(equipment); }