public IHttpActionResult Post(Project project) { using (AngularContext objDemoContext = new AngularContext()) { objDemoContext.Project.Add(project); objDemoContext.SaveChanges(); } return CreatedAtRoute("DefaultApi", new { Id = project.Id }, project); }
public IHttpActionResult Put(int id, Project project) { if (id != project.Id) { return BadRequest(); } using (AngularContext contextObj = new AngularContext()) { Project getProject = contextObj.Project.Find(id); getProject.Name = project.Name; contextObj.SaveChanges(); return CreatedAtRoute("DefaultApi", new { Id = project.Id }, project); } }