Beispiel #1
0
 public Staffs Add(Staffs staff)
 {
     //throw new System.NotImplementedException();
     context.Staffss.Add(staff);
     context.SaveChanges();
     return(staff);
 }
Beispiel #2
0
        public Staffs Update(Staffs staffChanges)
        {
            var staff = context.Staffss.Attach(staffChanges);

            staff.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
            return(staffChanges);
        }
Beispiel #3
0
        public Staffs Delete(int id)
        {
            Staffs staff = _staffsList.FirstOrDefault(e => e.Id == id);

            if (staff != null)
            {
                _staffsList.Remove(staff);
            }
            return(staff);
        }
Beispiel #4
0
        public Staffs Delete(int id)
        {
            Staffs staff = context.Staffss.Find(id);

            if (staff != null)
            {
                context.Staffss.Remove(staff);
                context.SaveChanges();
            }
            return(staff);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 public Staffs Add(Staffs staff)
 {
     staff.Id = _staffsList.Max(e => e.Id) + 1;
     _staffsList.Add(staff);
     return(staff);
 }