public string Post([FromBody] UserRegistrationInfo value) { UserEntity user = new UserEntity() { Name = value.Name, Surname = value.Surname, PhoneNumber = value.PhoneNumber }; usersService.Add(user); usersService.SaveChanges(); int id = usersService.GetId(value); return(Newtonsoft.Json.JsonConvert.SerializeObject(usersService.Get(id))); }
public int AddNewUser(UserInfo args) { var UserToAdd = new UserEntity() { Name = args.Name, SurName = args.SurName, Balance = args.Balance, Phone = args.Phone }; if (this.repo.Contains(UserToAdd)) { throw new ArgumentException("Не уникальный пользователь"); } repo.Add(UserToAdd); repo.SaveChanges(); return(UserToAdd.Id); }