public IHttpActionResult PutSkill(int id, Skill skill) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != skill.Id) { return BadRequest(); } db.Entry(skill).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SkillExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
// GET: Skills/Create public ActionResult Create() { Skill skill = new Skill(); skill.Categories = GetCategories(); skill.Statuses = GetStatuses(); skill.SkillStatus = "Active"; return View(skill); }
public IHttpActionResult PostSkill(Skill skill) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Skills.Add(skill); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = skill.Id }, skill); }