Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(string id)
        {
            customerSt customer = db.custom.Find(id);

            db.custom.Remove(customer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "customer_id,join_date,NameIdentifier,last_name,UserPhoto,mobile,email_id,address,birth_date,gender,status")] customerSt customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Exemplo n.º 3
0
        // GET: customers/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            customerSt customer = db.custom.Find(id);

            if (customer == null)
            {
                return(HttpNotFound());
            }
            return(View(customer));
        }
Exemplo n.º 4
0
        public ActionResult Create(Student student, HttpPostedFileBase filelist)
        {
            byte[] data = null;
            data = new byte[filelist.ContentLength];
            filelist.InputStream.Read(data, 0, filelist.ContentLength);
            var studentDummy = db.Students_Dummies.Where(x => x.StudentNumber == student.StudentNumber).FirstOrDefault();

            if (ModelState.IsValid)
            {
                if (lo.StudentNoExists(student.StudentNumber))
                {
                    TempData["message"] = "Student Number already exists.";
                    return(View("Create"));
                }
                if (studentDummy == null)
                {
                    TempData["message"] = "Invalid student number please check student number";
                    return(View("Index", db.Students.ToList()));
                }



                Random     r        = new Random();
                customerSt cs       = new customerSt();
                var        userName = User.Identity.GetUserName();
                var        userId   = User.Identity.GetUserId();
                student.Email  = userName;
                student.StudId = userId + r.Next(1, 100);
                //student.IdNumber = lo.getId(student.StudentNumber);
                //student.Gender = lo.getStudentGender(student.StudentNumber);
                student.RooNumber = lo.GetRoomNumber(userName);
                student.ResName   = lo.getResName(student.StudentNumber);
                student.UserPhoto = data;

                cs.email_id       = userName;
                cs.customer_id    = userId + r.Next(1, 100);
                cs.NameIdentifier = student.Name;

                cs.last_name = student.Surname;
                cs.gender    = student.Gender;
                db.custom.Add(cs);



                //Get Details From Dummy Table

                student.Surname = studentDummy.Name.Substring(0, 1) + "." + studentDummy.Surname;
                //student.Surname = studentDummy.Surname;
                student.Gender      = studentDummy.Gender;
                student.IdNumber    = studentDummy.IdNumber;
                student.PhoneNumber = studentDummy.PhoneNumber;
                student.IdForOut    = userId;
                db.Students.Add(student);
                //Bs.AddStudent(student);
                db.SaveChanges();

                return(RedirectToAction("Create", "StudentCheckIns"));
                //
            }

            return(View(student));
        }