public ActionResult Create(Client client)
 {
     _db.Clients.Add(client);
     if (client.StylistId != 0)
     {
         Stylist entry = _db.Stylists.FirstOrDefault(stylist => stylist.StylistId == client.StylistId);
         entry.CustomerCount   += 1;
         _db.Entry(entry).State = EntityState.Modified;
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public ActionResult Create([Bind(Exclude = "dateAdded,dateModified,mexpirydate")] Member member)
        {
            if (ModelState.IsValid)
            {
                member.mexpirydate  = DateTime.Now.AddYears(1);
                member.dateAdded    = DateTime.Now;
                member.dateModified = new DateTime();
                db.Members.Add(member);
                db.SaveChanges();
                member.MembershipID    = 1000 + member.MemberID;
                db.Entry(member).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(member));
        }
 public ActionResult Edit([Bind(Include = "Id,PIB,Name,Country,City,Address")] CarSalon carSalon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(carSalon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(carSalon));
 }
 public ActionResult Edit([Bind(Include = "CustomerId,FirstName,LastName,Phonenumber")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Beispiel #5
0
 public ActionResult Edit([Bind(Include = "BillingsID,dateSold")] Billing billing)
 {
     if (ModelState.IsValid)
     {
         db.Entry(billing).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(billing));
 }
 public ActionResult Edit([Bind(Include = "StylistId,FirstName,LastName")] Stylist stylist)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stylist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stylist));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Country,City")] Manufacturer manufacturer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(manufacturer).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(manufacturer);
 }
Beispiel #8
0
 public ActionResult Edit([Bind(Exclude = "dateModified")] RateList rateList)
 {
     if (ModelState.IsValid)
     {
         rateList.dateModified    = DateTime.Now;
         db.Entry(rateList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rateList));
 }
        public ActionResult Edit([Bind(Exclude = "dateModified")] Employees employees)
        {
            if (ModelState.IsValid)
            {
                employees.dateModified    = DateTime.Now;
                db.Entry(employees).State = EntityState.Modified;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(employees));
        }
Beispiel #10
0
 public ActionResult Edit([Bind(Include = "Id,Name,CarSalonId,ManufacturerId")] Contract contract)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contract).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CarSalonId     = new SelectList(db.CarSalon, "Id", "PIB", contract.CarSalonId);
     ViewBag.ManufacturerId = new SelectList(db.Manufacturer, "Id", "Name", contract.ManufacturerId);
     return(View(contract));
 }
Beispiel #11
0
 public ActionResult Edit([Bind(Include = "AppointmentID,StylistID,CustomerID,appointmentTime")] Appointment appointment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(appointment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerId", "FirstName", appointment.CustomerID);
     ViewBag.StylistID  = new SelectList(db.Stylists, "StylistId", "FirstName", appointment.StylistID);
     return(View(appointment));
 }
Beispiel #12
0
 public ActionResult Edit([Bind(Include = "Id,Model,Year,EngineVolume,Color,ManufacturerId,CarSalonId")] Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CarSalonId     = new SelectList(db.CarSalon, "Id", "PIB", car.CarSalonId);
     ViewBag.ManufacturerId = new SelectList(db.Manufacturer, "Id", "Name", car.ManufacturerId);
     return(View(car));
 }
Beispiel #13
0
        public ActionResult Create([Bind(Exclude = "Usedqty,Usedvolume,dateAdded,dateModified")] UsedProducts usedProducts)
        {
            var ogStock = db.Stocks.Find(usedProducts.StockID);

            if (ModelState.IsValid)
            {
                usedProducts.Usedvolume   = ogStock.volume;
                usedProducts.Usedqty      = 1;
                ogStock.qty               = ogStock.qty - 1;
                db.Entry(ogStock).State   = EntityState.Modified;
                usedProducts.dateAdded    = DateTime.Now;
                usedProducts.dateModified = new DateTime();
                db.UsedProducts.Add(usedProducts);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StockID     = new SelectList(db.Stocks, "StockID", "Title", usedProducts.StockID);
            ViewBag.EmployeesID = new SelectList(db.Employees, "EmployeesID", "FullName", usedProducts.EmployeesID);
            return(View(usedProducts));
        }
Beispiel #14
0
 public ActionResult Update(Client client, int StylistId)
 {
     if (StylistId != 0)
     {
         _db.StylistClient.Add(new StylistClient()
         {
             StylistId = StylistId, ClientId = client.ClientId
         });
     }
     _db.Entry(client).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #15
0
        public ActionResult DeleteConfirmed(int id)
        {
            _db.Stylists.Remove(_db.Stylists.FirstOrDefault(stylist => stylist.StylistId == id));
            List <Client> Clients = _db.Clients.Where(client => client.StylistId == id).ToList();

            foreach (Client client in Clients)
            {
                client.StylistId        = 0;
                _db.Entry(client).State = EntityState.Modified;
            }
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult AddPurchase([Bind(Exclude = "dateModified")] Stock stock, int?newqty)
        {
            if (newqty == null)
            {
                newqty = 0;
            }

            if (ModelState.IsValid)
            {
                if (newqty <= 0)
                {
                    return(Content("<script language='javascript' type='text/javascript'>alert('Can not AddPurchase as new Quantity is 0 !');</script>"));
                }
                else
                {
                    stock.dateModified    = DateTime.Now;
                    stock.qty             = stock.qty + (int)newqty;
                    db.Entry(stock).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            return(View(stock));
        }
 public ActionResult Update(Client client)
 {
     _db.Entry(client).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Stylist theStylist)
 {
     _db.Entry(theStylist).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = theStylist.StylistId }));
 }
 public ActionResult Update(Stylist new_stylist)
 {
     _dataBase.Entry(new_stylist).State = EntityState.Modified;
     _dataBase.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #20
0
 public ActionResult Edit(Stylist stylist)
 {
     _db.Entry(stylist).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }