public async Task <Users> Register(Users newUser) { var user = new Users() { Id = Guid.NewGuid().ToString(), Fname = newUser.Fname, Lname = newUser.Lname, Nickname = newUser.Nickname, Birthdate = newUser.Birthdate, Email = newUser.Email, Password = newUser.Password, ProfileImage = newUser.ProfileImage }; try { db.Add(user); await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException err) { throw err; } return(newUser); }
public async Task <Events> addEvent(Events eventObj) { try { var userObj = db.Users.Single(u => u.Id == eventObj.UserId); } catch (Exception err) { throw err; } var ev = new Events() { DateTime = eventObj.DateTime, EventName = eventObj.EventName, Memo = eventObj.Memo, UserId = eventObj.UserId }; db.Add(ev); await db.SaveChangesAsync(); return(ev); }