Example #1
0
        public ActionResult Create(Kunder _kundertocreate)
        {
            try
            {
                // TODO: Add insert logic here
                _entities.AddToKunders(_kundertocreate);

                _kundertocreate.Total = _kundertocreate.Price * _kundertocreate.Quantity;

                _entities.SaveChanges();
                return RedirectToAction("Index");

            }
            catch
            {
                return View();
            }
        }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Kunders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToKunders(Kunder kunder)
 {
     base.AddObject("Kunders", kunder);
 }
Example #3
0
 /// <summary>
 /// Create a new Kunder object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Kunder CreateKunder(global::System.Int32 id)
 {
     Kunder kunder = new Kunder();
     kunder.Id = id;
     return kunder;
 }
Example #4
0
        public ActionResult Edit(int id, Kunder FakturaItem)
        {
            try
            {
                // TODO: Add update logic here
                var FakturaEdit = _entities.Kunders.Single(p => p.Id == id);

                FakturaEdit.OCR = FakturaItem.OCR;
                FakturaEdit.Name = FakturaItem.Name;
                FakturaEdit.City = FakturaItem.City;
                FakturaEdit.Deadline = FakturaItem.Deadline;
                FakturaEdit.Article = FakturaItem.Article;
                FakturaEdit.Price = FakturaItem.Price;
                FakturaEdit.Quantity = FakturaItem.Quantity;
                FakturaEdit.Paid = FakturaItem.Paid;
                FakturaEdit.Total = FakturaEdit.Price * FakturaEdit.Quantity;

                _entities.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }