/// <summary> /// 登录 /// </summary> /// <returns></returns> public ActionResult UserLogin(LoginRequest login) { if (Request.HttpMethod == "POST") { Response <User> response = new Entity.Response <User>(); Request <LoginRequest> request = new Entity.Request <LoginRequest>(); LoginRequest data = new LoginRequest() { UserName = login.UserName, TrueName = login.TrueName, TellPhone = login.TellPhone, PassWord = login.PassWord }; request.Data = data; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.UserLogin(request); if (response != null && response.IsSuccess) { TempData["User"] = response.Result; return(Json(new { response.Result })); } else { return(Json(new { response.ErrorMsg })); } } else { return(View()); } }
public ActionResult UserList(UserQuery user) { if (Request.HttpMethod == "POST") { Response <List <User> > response = new Response <List <Entity.User> >(); List <object> list = new List <object>(); if (user != null) { Request <UserQuery> request = new Entity.Request <UserQuery>(); request.Data = user; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.GetUsers(request); //行号 #region if (response.Result != null && response.Result.Count > 0) { int index = 1; foreach (User item in response.Result) { list.Add(new { RowNum = index, UserID = item.UserID, UserName = item.UserName, TrueName = item.TrueName, PassWord = item.PassWord, TellPhone = item.TellPhone, Department = item.Department, Status = item.Status, Role = item.Role, Remark = item.Remark, AddTime = item.AddTime, ModifiedTime = item.ModifiedTime }); index++; } } #endregion } //return Json(new { data = response.Result }); //return Json(new { rows = response.Result, total = response.TotalCount }); return(Json(new { rows = list, total = response.TotalCount })); } else { return(View()); } }
public IHttpActionResult addRequest([FromBody] Entity.Request requestDetails) { string response = null; IUnityContainer container = new UnityContainer(); RequestBL requestBL = new RequestBL(container); try { response = JsonConvert.SerializeObject(requestBL.addRequest(requestDetails)); } catch (Exception ex) { var objErr = new ErrorClass(ex, ""); objErr.LogException(); } return(Ok(response)); }
/// <summary> /// 注册 /// </summary> /// <returns></returns> public ActionResult UserRegist(User user) { try { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); Request <User> request = new Entity.Request <User>(); User data = new Entity.User() { UserName = user.UserName, TrueName = user.TrueName, PassWord = user.PassWord, TellPhone = user.TellPhone, Department = user.Department, Status = user.Status, //ExistHours = 0, Remark = user.Remark, AddTime = DateTime.Now, ModifiedTime = DateTime.Now }; request.Data = data; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.AddUser(request); if (response != null && response.IsSuccess) { return(Json(response.IsSuccess, JsonRequestBehavior.AllowGet)); //return Json(new { data = list }); } else { return(Json(response.IsSuccess)); } } else { return(View()); } } catch (Exception ex) { throw ex; } }