public IHttpActionResult PutWorkorderType(int id, WorkorderType workorderType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != workorderType.workorderTypeID) { return(BadRequest()); } db.Entry(workorderType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!WorkorderTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { WorkorderType workorderType = db.WorkorderTypes.Find(id); db.WorkorderTypes.Remove(workorderType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "workorderTypeID,workorderTypeName")] WorkorderType workorderType) { if (ModelState.IsValid) { db.Entry(workorderType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workorderType)); }
public IHttpActionResult GetWorkorderType(int id) { WorkorderType workorderType = db.WorkorderTypes.Find(id); if (workorderType == null) { return(NotFound()); } return(Ok(workorderType)); }
public ActionResult Create([Bind(Include = "workorderTypeID,workorderTypeName")] WorkorderType workorderType) { if (ModelState.IsValid) { db.WorkorderTypes.Add(workorderType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workorderType)); }
public IHttpActionResult PostWorkorderType(WorkorderType workorderType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.WorkorderTypes.Add(workorderType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = workorderType.workorderTypeID }, workorderType)); }
public IHttpActionResult DeleteWorkorderType(int id) { WorkorderType workorderType = db.WorkorderTypes.Find(id); if (workorderType == null) { return(NotFound()); } db.WorkorderTypes.Remove(workorderType); db.SaveChanges(); return(Ok(workorderType)); }
// GET: WorkorderTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkorderType workorderType = db.WorkorderTypes.Find(id); if (workorderType == null) { return(HttpNotFound()); } return(View(workorderType)); }
protected override void Execute(CodeActivityContext context) { var myinput = WorkorderType.Get(context); }