public IHttpActionResult PostContact(RootObject rootcontact) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Contacts.Add(rootcontact.Contact); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = rootcontact.Contact.Id }, rootcontact.Contact); }
public IHttpActionResult PostResume(RootObject rootresume) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Resumes.Add(rootresume.Resume); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = rootresume.Resume.Id }, rootresume.Resume); }
public IHttpActionResult DeleteContact(int id) { Contact contact = db.Contacts.Find(id); if (contact == null) { return NotFound(); } db.Contacts.Remove(contact); db.SaveChanges(); RootObject rootobject = new RootObject(); rootobject.Contact = contact; return Ok(rootobject); }
public IHttpActionResult DeletePosition(int id) { Position position = db.Positions.Find(id); if (position == null) { return NotFound(); } db.Positions.Remove(position); db.SaveChanges(); RootObject rootobject = new RootObject(); rootobject.Position = position; return Ok(rootobject); }
public IHttpActionResult DeleteProfile(int id) { Profile profile = db.Profiles.Find(id); if (profile == null) { return NotFound(); } db.Profiles.Remove(profile); db.SaveChanges(); RootObject rootobject = new RootObject(); rootobject.Profile = profile; return Ok(rootobject); }
public IHttpActionResult DeleteEvent(int id) { Event @event = db.Events.Find(id); if (@event == null) { return NotFound(); } db.Events.Remove(@event); db.SaveChanges(); RootObject rootobject = new RootObject(); rootobject.Event = @event; return Ok(rootobject); }
public IHttpActionResult DeleteOrg(int id) { Org org = db.Orgs.Find(id); if (org == null) { return NotFound(); } db.Orgs.Remove(org); db.SaveChanges(); RootObject rootobject = new RootObject(); rootobject.Org = org; return Ok(rootobject); }
public IHttpActionResult PutContact(int id, RootObject rootobject) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != rootobject.Contact.Id) { return BadRequest(); } db.Entry(rootobject.Contact).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ContactExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostProfile(RootObject rootobject) { if (!ModelState.IsValid || rootobject.Profile == null) { return BadRequest(ModelState); } db.Profiles.Add(rootobject.Profile); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = rootobject.Profile.Id }, rootobject.Profile); }
public IHttpActionResult PostEvent(RootObject rootevent) { if (!ModelState.IsValid || rootevent.Event == null) { return BadRequest(ModelState); } db.Events.Add(rootevent.Event); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = rootevent.Event.Id }, rootevent.Event); }