public static void AddUser([FromBody] User user) { try { UserBL.AddUser(user); } catch { throw; } }
public ActionResult Register(User u) { UserBL userBL = new UserBL(); if (ModelState.IsValid) { userBL.AddUser(u); return(RedirectToAction("Login", "Home")); } return(View()); }
// POST api/User public IHttpActionResult Post([FromBody] User u) { try { UserBL.AddUser(u); return(Ok()); } catch { throw; } }
private void tmAddUser_Click(object sender, EventArgs e) { fmUser fm = new fmUser(); //User user = new User(); fm.title = title; if (fm.ShowDialog(this) == DialogResult.OK) { users.AddUser(fm.FirstName, fm.LastName, fm.DateOfBirthDay /*, fm.UsersAward*/); dgUsers.DataSource = null; dgUsers.DataSource = users.GetUsersList(); } }
public IHttpActionResult AddUser(User item) { UserBL blUser = new UserBL(); try { blUser.AddUser(item); } catch (Exception ex) { return(Ok(ex.Message)); } return(Ok()); }
public ActionResult CreateUser([FromForm] User user) { CustomResponse response = UserBL.AddUser(user, _userRepository); if (!response.success) { return(PartialView("Error", response)); } ICollection <User> users = UserBL.GetAllUsersSync(_userRepository); return(PartialView("GetAllUsers", new UsersViewModel { Users = users.ToList() })); }
public ActionResult CreateProjectUser(ProjectUserViewModel model) { UserBL userBL = new UserBL(); OperationDetails operationDetails; UserModel user = userBL.GetUserByPfid(model.Pfid); if (user != null) { if (user.RoleId == (int)EnumHelper.Role.SuperAdmin) { return(Json(new { success = false, message = "Cannot assign project to admin user." }, JsonRequestBehavior.AllowGet)); } } else { // If user not found in User table, get user from HRMS service. user = userBL.GetUserFromService(model.Pfid); if (user == null) { return(Json(new { success = false, message = "Employee with this PFID does not exist." }, JsonRequestBehavior.AllowGet)); } user.CreatedBy = CurrentUser.Pfid; operationDetails = userBL.AddUser(user); if (operationDetails.OperationStatus != 1) { return(Json(new { success = false, message = "Something went wrong!!" }, JsonRequestBehavior.AllowGet)); } } ProjectMappingModel projectMapping = new ProjectMappingModel(); projectMapping.Pfid = model.Pfid; projectMapping.ProjectId = model.ProjectId; projectMapping.IsProjectAdmin = model.IsAdmin ? 1 : 0; projectMapping.CreatedBy = CurrentUser.Pfid; operationDetails = userBL.AddProjectMapping(projectMapping); if (operationDetails.OperationStatus == 1) { return(Json(new { success = true, message = "User added to project successfully." }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = false, message = "Something went wrong!!" }, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult <object> > Post([FromBody] UserDTO user) { if (UserIsValid(user)) { string now = DateTime.Now.ToString(); user.SessionKey = (user.Name + now).GetHashCode().ToString(); var result = await _userBL.AddUser(user); return(result); } else { return(BadRequest(new { errorMessage = "Invalid Data" })); } }
public IHttpActionResult AddUser(Entities.User user) { UserBL userBl = new UserBL(_context); try { userBl.AddUser(user); } catch (Exception ex) { return(InternalServerError(ex)); } finally { userBl = null; } return(Ok()); }
public ActionResult Create(PersonVM item) { if (ModelState.IsValid) { Person p = new Person() { UserId = item.UserId, Password = item.Pwd, Email = item.Email, FullName = item.Name, Active = true, Joined = DateTime.Now }; obj.AddUser(p); return RedirectToAction("Login"); } else return View(); }
public JsonResult AddUserRow(UserDto user) { user.ClientId = _authUser.ClientId; var tempPwd = user.Password; user.Password = Utils.Encrypt(tempPwd); if (user.ManagerUserID == 0) { user.ManagerUserID = null; } user.CloudLastUpdBy = _authUser.UserId; var nList = _userBl.AddUser(user); var userAdded = new UserHandlerModel { StrMessage = "There was an error" }; userAdded.MgUserId = nList; userAdded.StrMessage = tempPwd; return(Json(userAdded, JsonRequestBehavior.AllowGet)); }
public async Task <ResultResponse <User> > CreateUser([FromBody] User user) { var userBL = new UserBL(_userRepository); try { await userBL.AddUser(user); return(new ResultResponse <User> { Success = true, Item = user, Message = "Successfully created acccount!", Token = _tokenHelper.GenerateToken(user) }); } catch (Exception ex) { return(GetErrorResponse <User>(ex, "Error creating user! Please try again.")); } }
public ActionResult Register(RegisterVM vm) { if (!ModelState.IsValid) { ModelState.AddModelError("CredentialError", errorMessage: "Wrong username or password"); return(View(vm)); } UserBL userBL = new UserBL(); if (userBL.isUniqueName(vm.UserName)) { userBL.AddUser(vm); } else { ModelState.AddModelError("CredentialError", errorMessage: "Username is taken, choose another"); return(View(vm)); } return(RedirectToAction("Login")); }
public ActionResult Create(PersonVM item) { try { if (ModelState.IsValid) { Person p = new Person() { UserId = item.UserId, Pwd = Encrypt(item.Pwd), Email = item.Email, Name = item.Name, Active = true, Joined = DateTime.Now }; var status = obj.AddUser(p); if (status == null) { return(RedirectToAction("Login")); } else { ViewBag.Message = status; return(View()); } } else { return(View()); } } catch (Exception Ex) { Logger.WriteError(Ex, "Create", "User"); return(View("Error")); } }
public ActionResult DoAddUser(UserInfo userInfo, string GroupId) { var result = new ActionBusinessResult(); try { var userBL = new UserBL(); userInfo.CreatedBy = SessionData.CurrentUser.Username; string _pass = userInfo.Password; result = userBL.AddUser(userInfo, GroupId); if (result.IsActionSuccess == true) { Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = userInfo.Email, EmailCC = "", Subject = "Email thông báo đăng ký mở tài khoản thành công", Content = "Dear " + userInfo.FullName + ", Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", LstAttachment = new List <string>(), }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); } } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { result = result.ToJson() })); }
// POST api/users public void Post([FromBody] UserDTO user) { UserBL.AddUser(user); }
public ActionResult <User> AddUser([FromBody] User user) { return(_userBL.AddUser(user)); }
public void Post([FromUri] UserDTO user) { userBL.AddUser(user); }
public static void AddUserDetails(UserBO UserBO) { UserBL objUserBL = new UserBL(); objUserBL.AddUser(UserBO); }
public void AddUser(CommonEntities.Users user) { var userBL = new UserBL(mockContext); userBL.AddUser(user); }