public ActionResult Edit([Bind(Include = "Id,Title,SkilLevel")] Skils skils) { if (ModelState.IsValid) { db.Entry(skils).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skils)); }
public ActionResult Create([Bind(Include = "Id,Title,SkilLevel")] Skils skils) { if (ModelState.IsValid) { db.Skils.Add(skils); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skils)); }
// GET: Skils/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Skils skils = db.Skils.Find(id); if (skils == null) { return(HttpNotFound()); } return(View(skils)); }
public Skils GetSkill(string id) { Skils skil = new Skils(); try { skil = this.db.Skils.FirstOrDefault(x => x.Id == id); } catch (Exception e) { this.logService.AddLog(e.Message, LogTypes.Error.ToString()); } return(skil); }
// GET: Skils/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Skils skils = db.Skils.Find(id); if (skils == null) { return(HttpNotFound()); } db.Skils.Remove(skils); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool DeleteSkill(string id) { bool operationOk = true; try { Skils skil = this.db.Skils.FirstOrDefault(x => x.Id == id); this.db.Skils.Remove(skil); this.db.SaveChanges(); } catch (System.Exception e) { this.logService.AddLog(e.Message, LogTypes.Error.ToString()); operationOk = false; } return(operationOk); }
public bool AddSkill(Skils skill) { bool operationOk = true; try { this.db.Skils.Add(skill); this.db.SaveChanges(); } catch (Exception e) { this.logService.AddLog(e.Message, LogTypes.Error.ToString()); operationOk = false; } return(operationOk); }
public bool EditSkill(Skils newSkill, string id) { bool operationOk = true; try { Skils oldSkil = this.db.Skils.FirstOrDefault(x => x.Id == id); oldSkil.Content = newSkill.Content; oldSkil.Image = newSkill.Image; oldSkil.ImageId = newSkill.ImageId; oldSkil.Title = newSkill.Title; } catch (System.Exception e) { this.logService.AddLog(e.Message, LogTypes.Error.ToString()); operationOk = false; } return(operationOk); }