public void UpdateParticipation(ParticipationModel p) { Participation p1 = db.Participations.Where(i => i.Project_ID == p.Project_ID && i.Employee_ID == p.Employee_ID).FirstOrDefault(); db.Entry(ToParticipation(p1, p)).State = EntityState.Modified; db.SaveChanges(); }
public Participation ToParticipation(Participation pt, ParticipationModel pt1) { pt1.EmployeeName = db.Employees.Where(i => i.ID == pt1.Employee_ID).FirstOrDefault().Name; pt1.RoleName = db.Roles.Where(i => i.ID == pt1.Role).FirstOrDefault().Name; return(pt = new Participation { Employee_ID = pt1.Employee_ID, Project_ID = pt1.Project_ID, Role = pt1.Role, Award = pt1.Award }); }
public void DeleteParticipation(ParticipationModel pt) { db.Participations.Remove(db.Participations.Where(i => i.Employee_ID == pt.Employee_ID && i.Project_ID == pt.Project_ID).FirstOrDefault()); }
public void AddParticipation(ParticipationModel pt) { db.Participations.Add(ToParticipation(new Participation(), pt)); }