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

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

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

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