public IHttpActionResult PutAIAUser(int id, AIAUser aIAUser) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != aIAUser.Id) { return BadRequest(); } db.Entry(aIAUser).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AIAUserExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public void Register() { AIAUser newUser = new AIAUser(); newUser.FirstName = registrationViewModel.FirstName; newUser.LastName = registrationViewModel.LastName; newUser.UserName = registrationViewModel.UserName; newUser.CanUseSystem = 0; Helper.Post<AIAUser>(newUser); }
public IHttpActionResult PostAIAUser(AIAUser aIAUser) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.AIAUsers.Add(aIAUser); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = aIAUser.Id }, aIAUser); }