public ActionResult LaunchRepairCase()
        {
            //  List<Global> gl = new List<Global>();
            var gl = _db.Globals.ToList();

            if (gl.Count == 0)
            {
                Global go = new Global()
                {
                    RegistrationStatus = true,
                    id = 1
                };
                _db.Globals.Add(go);
                _db.SaveChanges();
            }

            Global gg = _db.Globals.FirstOrDefault();

            if (gg.RegistrationStatus == false)
            {
                return(View("RegistrationDisabled"));
            }
            tools = null;
            Session["toolsList"] = null;
            Customer cc = Session["customer"] as Customer;

            RepairCase rc = new RepairCase()
            {
                CustomerIdd      = cc.CustomerId,
                ReceptionDate    = DateTime.Today,
                RegistrationDate = DateTime.Today
            };

            return(View(rc));
        }
Beispiel #2
0
        public ActionResult HandleRegistration()
        {
            var cc = vctxt.Globals.ToList();

            if (cc.Count == 0)
            {
                Global cc1 = new Global()
                {
                    id = 1,
                    RegistrationStatus = true
                };
                vctxt.Globals.Add(cc1);
                vctxt.SaveChanges();
            }

            ViewBag.activate = "Deactivate Registration";
            Global cs = vctxt.Globals.FirstOrDefault();

            if (cs.RegistrationStatus == true)
            {
                ViewBag.activate = "Deactivate Registration";
            }
            else
            {
                ViewBag.activate = "Activate Registration";
            }
            return(View(cs));
            //  RedirectToAction("activateRegistration");
        }
        public ActionResult Create([Bind(Include = "TechnicianId,TechnicianName,TechnicianPhone,TechnicianEmail,NumberOfOperations,Active")] Technician technician)
        {
            if (ModelState.IsValid)
            {
                _db.Technicians.Add(technician);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(technician));
        }
        public ActionResult Create([Bind(Include = "RepairCaseId,Note,ReceptionDate,CompletionDate,PickUpDate,LatestPickUpDate,Agreement,TechnicianIdd,CustomerIdd")] RepairCase repairCase)
        {
            if (ModelState.IsValid)
            {
                repairCase.Situation        = advancement.Registered;
                repairCase.RegistrationDate = DateTime.Today;
                _db.RepairCases.Add(repairCase);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(repairCase));
        }
        public ActionResult Create([Bind(Include = "CustomerId,FirstName,LastName,CustomerPhone,CustomerEmail,NumberOfRequests")] Customer customer)
        {
            //try
            //{

            if (ModelState.IsValid)
            {
                _db.Customers.Add(customer);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }