public Staffs Add(Staffs staff) { //throw new System.NotImplementedException(); context.Staffss.Add(staff); context.SaveChanges(); return(staff); }
public Staffs Update(Staffs staffChanges) { var staff = context.Staffss.Attach(staffChanges); staff.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(staffChanges); }
public Staffs Delete(int id) { Staffs staff = _staffsList.FirstOrDefault(e => e.Id == id); if (staff != null) { _staffsList.Remove(staff); } return(staff); }
public Staffs Delete(int id) { Staffs staff = context.Staffss.Find(id); if (staff != null) { context.Staffss.Remove(staff); context.SaveChanges(); } return(staff); }
public Staffs Update(Staffs staffChanges) { Staffs staff = _staffsList.FirstOrDefault(e => e.Id == staffChanges.Id); if (staff != null) { staff.Name = staffChanges.Name; staff.Email = staffChanges.Email; staff.Department = staffChanges.Department; } return(staff); }
public Staffs Add(Staffs staff) { staff.Id = _staffsList.Max(e => e.Id) + 1; _staffsList.Add(staff); return(staff); }