Ejemplo n.º 1
0
        public ActionResult Create(Equipment equipment)
        {
            if (ModelState.IsValid)
            {
                db.Equipment.AddObject(equipment);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(equipment);
        }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Equipment EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEquipment(Equipment equipment)
 {
     base.AddObject("Equipment", equipment);
 }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
 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);
 }