示例#1
0
        public JsonResult register(student stud)
        {
            if (ModelState.IsValid)
            {
                if (this.isEmailExist(stud.email))
                {
                    return(Json(new { status = "fail", msg = "Email Already Exist" }, JsonRequestBehavior.AllowGet));
                }

                using (adamlye_studmanEntities st = new adamlye_studmanEntities())
                {
                    st.students.AddObject(stud);
                    int res = st.SaveChanges();
                    if (res > 0)
                    {
                        return(Json(new { status = "success", msg = "register Successfull" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { status = "fail", msg = "not Able to Register" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            else
            {
                return(Json(new { status = "fail", msg = "invalid Request" }, JsonRequestBehavior.AllowGet));
            }
        }
示例#2
0
 public bool isEmailExist(string email)
 {
     using (adamlye_studmanEntities se = new adamlye_studmanEntities())
     {
         var v = se.students.Where(a => a.email == email).FirstOrDefault();
         return(v != null);
     }
 }
示例#3
0
        //
        // GET: /Student/

        public ActionResult Index()
        {
            adamlye_studmanEntities st = new adamlye_studmanEntities();

            var data = (from student in st.students.Take(10) select student);

            return(Json(new { status = "success", msg = "working", data = data }, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        //
        // GET: /Institute/

        public JsonResult Index()
        {
            //JsonResult js = new JsonResult();
            adamlye_studmanEntities ins = new adamlye_studmanEntities();

            return(Json(ins.tbl_institute, JsonRequestBehavior.AllowGet));

            //return View();
        }
示例#5
0
 public JsonResult login(student stud)
 {
     using (adamlye_studmanEntities st = new adamlye_studmanEntities())
     {
         var v = st.students.Where(a => a.email == stud.email).FirstOrDefault();
         if (v != null)
         {
             if (string.Compare(stud.password, v.password) == 0)
             {
                 return(Json(new { status = "Success", msg = "Login Success" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { status = "fail", msg = "Wrong Credential" }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { status = "fail", msg = "Wrong Credential" }, JsonRequestBehavior.AllowGet));
         }
     }
 }