public HttpResponseMessage PostAccount(AccountModel json) { //var newAccount = AccountModel.CreateAccount(username, password, email); json.ID = IdentificationNumber.NewID(); json.EntriesOwned = new List<IdentificationNumber>(); json.EventsOwned = new List<IdentificationNumber>(); json.CommentEntries = new List<IdentificationNumber>(); SQLCommand.ExecuteQuery("INSERT INTO dbo.Users VALUES ('" + json.ID.ID + "','" + json.Username + "','" + json.Password + "','" + json.Email + "')"); SQLCommand.ExecuteQuerySaveObject<AccountModel>("a", json); return new HttpResponseMessage(HttpStatusCode.Accepted); }
public HttpResponseMessage DeleteAccount(AccountModel model) { try { SQLCommand.ExecuteQueryRemoveAccount(model.ID.ID, model.Username, model.Password, model.Email); return new HttpResponseMessage(HttpStatusCode.OK); } catch (Exception e) { Debug.WriteLine(e.StackTrace); return new HttpResponseMessage(HttpStatusCode.NotFound); } }
public static AccountModel CreateAccount(string username, string password, string email) { var am = new AccountModel() { Username = username, Password = password, Email = email, ID = IdentificationNumber.NewID(), EventsOwned = new List<IdentificationNumber>(), EntriesOwned = new List<IdentificationNumber>(), CommentEntries = new List<IdentificationNumber>() }; am.EventsOwned.Add(IdentificationNumber.blankID()); am.EntriesOwned.Add(IdentificationNumber.blankID()); am.CommentEntries.Add(IdentificationNumber.blankID()); return am; }