public ActionResult Create([Bind(Include = "Id,Username,Password,Name,Address,Email,PhoneNumber,Role")] User user) { if (ModelState.IsValid) { _userService.AddNewUser(user); return(RedirectToAction("Index")); } return(View(user)); }
public async Task <dynamic> AddNewUser([FromBody] UserModel user) { var addedUser = await usersService.AddNewUser(user); if (addedUser == null) { return(BadRequest()); } return(Ok(addedUser)); }
public void PostAdd(JObject json) { var user = JsonConvert.DeserializeObject <UserInfo>(json.ToString()); usersService.AddNewUser(user); }
public void Run() { int UserSelect = SelectFeature(); switch (UserSelect) { case 1: if (!tradeStart) { tradeStart = true; thread = new Thread(new ThreadStart(Transaction)); thread.Start(); } else { tradeStart = false; } break; case 2: new UserView(phraseProvider, iOProvider) .PrinaAllUsers(usersService.GetAllUsers()); iOProvider.ReadKey(); break; case 3: usersService.AddNewUser(new UserView(phraseProvider, iOProvider) .CreateUser()); break; case 4: new ShareView(phraseProvider, iOProvider) .PrintAllShares(shareServices.GetAllShares()); iOProvider.WriteLine(phraseProvider.GetPhrase("BackToMain")); iOProvider.ReadKey(); break; case 5: ShareView share = new ShareView(phraseProvider, iOProvider); share.PrintAllShares(shareServices.GetAllShares()); try { shareServices.ChangeSharePrice(share.ShareId(), share.ShareNewPrice()); } catch (Exception ex) { iOProvider.WriteLine(ex.Message); } iOProvider.WriteLine(phraseProvider.GetPhrase("BackToMain")); iOProvider.ReadKey(); break; case 6: new UserView(phraseProvider, iOProvider) .PrintAllUsersInOrange(usersService.GetAllUsersWithZero()); iOProvider.ReadKey(); break; case 7: new UserView(phraseProvider, iOProvider) .PrintAllUsersInBlack(usersService.GetAllUsersWithNegativeBalance()); iOProvider.ReadKey(); break; } }
public async Task <ActionResult <ResponseResult <User> > > AddNewUser([FromBody] User newUser) { var result = await _usersService.AddNewUser(newUser); return(result); }