public int Register(Users user) { UserOperations userOperations = new UserOperations(); int result = userOperations.AddUser(user); return(result); }
public ActionResult Register(AccountUser user) { AccountUser user1 = new AccountUser(); user1 = userOperations.FindUser(user.UserName); if (user1.UserName == "empty") { int reg = userOperations.AddUser(user); if (reg != 0) { FormsAuthentication.SetAuthCookie(user.UserName, true); if (user.UserRoots == "user") { return(RedirectToAction("Index", "User")); } if (user.UserRoots == "admin") { return(RedirectToAction("Index", "Admin")); } } } else { ModelState.AddModelError("", "User " + user.UserName + " exists! Try to write other name."); } return(View()); }
public void Handle(IConsoleAdapter console, IErrorAdapter error, IMapper mapper) { try { var ops = new UserOperations("https://senlabltd.eu.auth0.com/api/v2/", ClientId, Secret, mapper); var user = ops.AddUser(Email, Password); console.WrapLine($"{user.UserId} created.".Cyan()); } catch (AggregateException e) { error.WrapLine($"Unable to create user {Email} due to error:".Yellow()); error.WrapLine(e.Message.Red()); foreach (var exception in e.InnerExceptions) { error.WrapLine(exception.Message.Red()); } Environment.ExitCode = -100; } catch (Exception e) { error.WrapLine($"Unable to create user {Email} due to error:".Yellow()); error.WrapLine(e.Message.Red()); if (e.InnerException != null) { error.WrapLine(e.InnerException.Message.Red()); } Environment.ExitCode = -100; } }
private void addBtn_Click(object sender, EventArgs e) { UserOperations up = new UserOperations(); User user = new User(); user = retrieve(); up.AddUser(user); }
public void GetUserTest() { var groupOperations = new UserOperations(); groupOperations.GetUsers(); groupOperations.AddUser(new Models.MUser()); groupOperations.GetUserById(0); }
public long AddUser(VoUser user) { //Demonstration of creating an AmbientDbContext in transaction mode using (var dbContextScope = new DbContextScopeFactory().CreateAmbientDbContextInReadonlyMode <BloggerDbContext>()) { var addedUser = _userOperations.AddUser(user); dbContextScope.SaveChanges(); dbContextScope.Commit(); return(addedUser.UserId); } }
public ActionResult AdminTimetable(string login, string role, string password, string passwordrepeat) { if (!password.Equals(passwordrepeat)) { ViewBag.Message = "Passwords dont match"; return(View()); } UserOperations uo = new UserOperations(); uo.AddUser(new MUser(login, password, role)); ViewBag.Message = "Succesfully registred"; return(View()); }
public ActionResult SingUp(string login, string password, string passwordrepeat) { if (!password.Equals(passwordrepeat)) { ViewBag.Message = "Passwords dont match"; return(View()); } UserOperations uo = new UserOperations(); uo.AddUser(new MUser(login, password, "student")); ViewBag.Message = "Succesfully registred"; return(View()); }
private void btnAdd_Click(object sender, EventArgs e) { User user = new User(); user.UserName = txtUserName.Text; user.Password = txtPassword.Text; user.firstName = txtFirstName.Text; user.lastName = txtFirstName.Text; user.IsAdmin = chkAdmin.Checked; user.DateOfBirth = dtpDateOfBirth.Value; UserOperations bl = new UserOperations(); bl.AddUser(user); MessageBox.Show("Operation succesful"); }
static void Main(string[] args) { int gid, depid, addtype, userid, Subid; //Output Instructions for User Console.WriteLine("Register ...press 1"); Console.WriteLine("Add address to your profile... press 2 "); Console.WriteLine("Update your information...press 3"); Console.WriteLine("Update address... press 4"); //Input from user var op = Convert.ToInt16(Console.ReadLine()); if (op == 1)//Enter Registation information { Console.WriteLine("Enter Firstname"); user.FirstName = Console.ReadLine(); Console.WriteLine("Enter Lastname"); user.LastName = Console.ReadLine(); Console.WriteLine("Enter email"); user.EmailAddress = Console.ReadLine(); Console.WriteLine("Enter Password"); user.Password = Console.ReadLine(); Console.WriteLine("Enter gender... press 1 for Male/... press 2 for Female"); gid = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter deparment ...press 1 for GMIC /press 2 for GMOB /press 3 for GQA"); depid = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(userOps.AddUser(user, depid, gid)); } else if (op == 2)//Enter Address information { Console.WriteLine("Enter UnitNumber"); addr.UnitNumber = Console.ReadLine(); Console.WriteLine("Enter StreetName"); addr.StreetName = Console.ReadLine(); Console.WriteLine("Enter ComplexNumber"); addr.ComplexNumber = Console.ReadLine(); Console.WriteLine("Enter UserId"); addr.RegisteredUserID = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter address typeid..press 1 for physcal address.. press 2 for postal address"); addtype = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(addressOps.InsertAddress(addr, addr.RegisteredUserID, addtype, 1)); } else if (op == 3)//Enter update user Information { Console.WriteLine("Enter userid"); userid = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter Firstname"); user.FirstName = Console.ReadLine(); Console.WriteLine("Enter Lastname"); user.LastName = Console.ReadLine(); Console.WriteLine("Enter email"); user.EmailAddress = Console.ReadLine(); Console.WriteLine("Enter Password"); user.Password = Console.ReadLine(); Console.WriteLine(userOps.UpdateUser(userid, user)); } else if (op == 4)//Enter update address information { Console.WriteLine("Enter AdressId"); addr.AddressID = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter UnitNumber"); addr.UnitNumber = Console.ReadLine(); Console.WriteLine("Enter StreetName"); addr.StreetName = Console.ReadLine(); Console.WriteLine("Enter ComplexNumber"); addr.ComplexNumber = Console.ReadLine(); Console.WriteLine("Enter UserId"); addr.RegisteredUserID = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter address typeid..press 1 for physcal address.. press 2 for postal address"); addtype = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter Suburb ID"); Subid = Convert.ToInt16(Console.ReadLine()); Console.WriteLine(addressOps.UpdateAddress(addr.AddressID, addr, Subid, addtype)); } else if (op == 5) { userOps.UserInfo(); } else if (op == 6) { Console.WriteLine(userOps.SoftDeleteUser(3)); } Console.ReadKey(); }