public IHttpActionResult PutAreaOfExpertise(int id, AreaOfExpertiseViewModel AreaOfExpertiseViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != AreaOfExpertiseViewModel.Id) { return(BadRequest()); } AreaOfExpertise AreaOfExpertise = new AreaOfExpertise(); Mapper.CreateMap <AreaOfExpertiseViewModel, AreaOfExpertise>(); AreaOfExpertise = Mapper.Map <AreaOfExpertiseViewModel, AreaOfExpertise>(AreaOfExpertiseViewModel); db.Entry(AreaOfExpertise).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AreaOfExpertiseExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAreaOfExpertise(int id, AreaOfExpertise areaOfExpertise) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != areaOfExpertise.AreaOfExpertiseId) { return(BadRequest()); } db.Entry(areaOfExpertise).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AreaOfExpertiseExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Edit(int id, [Bind("AreaId,PinLocation,GuideId")] AreaOfExpertise areaOfExpertise) { if (id != areaOfExpertise.AreaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(areaOfExpertise); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AreaOfExpertiseExists(areaOfExpertise.AreaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GuideId"] = new SelectList(_context.Guides, "GuideId", "GuideId", areaOfExpertise.GuideId); return(View(areaOfExpertise)); }
public ActionResult DeleteConfirmed(int id) { AreaOfExpertise areaOfExpertise = db.AreaOfExpertise.Find(id); db.AreaOfExpertise.Remove(areaOfExpertise); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AreaOfExpertiseId,AreaOfExpertiseName,AreaOfExpertiseDescription")] AreaOfExpertise areaOfExpertise) { if (ModelState.IsValid) { db.Entry(areaOfExpertise).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(areaOfExpertise)); }
public ActionResult Create([Bind(Include = "AreaOfExpertiseId,AreaOfExpertiseName,AreaOfExpertiseDescription")] AreaOfExpertise areaOfExpertise) { if (ModelState.IsValid) { db.AreaOfExpertise.Add(areaOfExpertise); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(areaOfExpertise)); }
public IHttpActionResult GetAreaOfExpertise(int id) { AreaOfExpertise areaOfExpertise = db.AreaOfExpertise.Find(id); if (areaOfExpertise == null) { return(NotFound()); } return(Ok(areaOfExpertise)); }
public IHttpActionResult PostAreaOfExpertise(AreaOfExpertise areaOfExpertise) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AreaOfExpertise.Add(areaOfExpertise); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = areaOfExpertise.AreaOfExpertiseId }, areaOfExpertise)); }
public async Task <IActionResult> Create([Bind("AreaId,PinLocation,GuideId")] AreaOfExpertise areaOfExpertise) { if (ModelState.IsValid) { _context.Add(areaOfExpertise); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["GuideId"] = new SelectList(_context.Guides, "GuideId", "GuideId", areaOfExpertise.GuideId); return(View(areaOfExpertise)); }
// GET: AreaOfExpertises/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AreaOfExpertise areaOfExpertise = db.AreaOfExpertise.Find(id); if (areaOfExpertise == null) { return(HttpNotFound()); } return(View(areaOfExpertise)); }
public IHttpActionResult DeleteAreaOfExpertise(int id) { AreaOfExpertise areaOfExpertise = db.AreaOfExpertise.Find(id); if (areaOfExpertise == null) { return(NotFound()); } db.AreaOfExpertise.Remove(areaOfExpertise); db.SaveChanges(); return(Ok(areaOfExpertise)); }
public IHttpActionResult PostAreaOfExpertise(AreaOfExpertiseViewModel AreaOfExpertiseViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } AreaOfExpertise AreaOfExpertise = new AreaOfExpertise(); Mapper.CreateMap <AreaOfExpertiseViewModel, AreaOfExpertise>(); AreaOfExpertise = Mapper.Map <AreaOfExpertiseViewModel, AreaOfExpertise>(AreaOfExpertiseViewModel); db.AreaOfExpertise.Add(AreaOfExpertise); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = AreaOfExpertise.Id }, AreaOfExpertise)); }