public void DeleteById(int id) // Delete function { TrackSkill emp = GetById(id); dbconn.TrackSkills.Remove(emp); dbconn.SaveChanges(); }
public TrackSkill Add(TrackSkill emp) // Adding Function { TrackSkill addedEmp = dbconn.TrackSkills.Add(emp); dbconn.SaveChanges(); return(addedEmp); }
//// Add Skills public ActionResult AddSkills(int skillId, int trackId) // ID of track { var trackSkill = new TrackSkill(); trackSkill.TrackID = trackId; List <Skill> skills = skillsbusinessManager.GetUnmappedSkillsByTrackId(trackId); if (skills.Where(s => s.ID == skillId).FirstOrDefault() != null) { trackSkill.SkillD = skillId; trackskillsbusinessManager.Add(trackSkill); } var trackSkills = trackskillsbusinessManager.GetByTrackID(trackId); return(PartialView("_trackSkills", trackSkills)); }
// Adding a new skill not in the database public ActionResult AddNewSkill(int trackId, string skill) { var trackSkill = new TrackSkill(); Skill NewSkill = new Skill(); NewSkill.Name = skill; var added = skillsbusinessManager.Add(NewSkill); trackSkill.TrackID = trackId; List <Skill> skills = skillsbusinessManager.GetUnmappedSkillsByTrackId(trackId); if (skills.Where(j => j.ID == added.ID).FirstOrDefault() != null) { trackSkill.SkillD = added.ID; trackskillsbusinessManager.Add(trackSkill); } var trackSkills = trackskillsbusinessManager.GetByTrackID(trackId); return(PartialView("_trackSkills", trackSkills)); }
public TrackSkill Update(TrackSkill emp) // Update Function { dbconn.Entry(emp).State = EntityState.Modified; dbconn.SaveChanges(); return(emp); }
public TrackSkill GetById(int id) // Get the ID Function { TrackSkill emp = dbconn.TrackSkills.Where(e => e.ID == id).FirstOrDefault(); return(emp); }
public TrackSkill Update(TrackSkill emp) { return(tracksskillsdatamanager.Update(emp)); }
public TrackSkill Add(TrackSkill emp) { return(tracksskillsdatamanager.Add(emp)); }