Ejemplo n.º 1
0
        public JsonResult UserAuthentication(String email, String password)
        {
            UserServices service = new UserServices();
            User existinguser= service.UserLogin(email, password);
            if (existinguser!=null && existinguser.ID>0)
            {
                SessionManagement.SetValue("UserId", existinguser.ID.ToString());
                SessionManagement.SetValue("UserName", existinguser.Name.ToString());
                return Json(existinguser, JsonRequestBehavior.AllowGet);
            }

            else {
                Error err = new Error();
                err.ErrorMessage = "Username and password does not match";
                return Json(err, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 2
0
        public JsonResult UserSignUp(User objUser)
        {
            if (ModelState.IsValid)
            {
                UserServices service = new UserServices();
                service.SaveUser(objUser);

                return Json(objUser, JsonRequestBehavior.AllowGet);
            }

            return Json("", JsonRequestBehavior.AllowGet);
        }