public void Save(StaffTypeViewModel staffTypeViewModel) { using (var _context = new NasscomEntities()) { _context.StaffType.Add(GetEntity(staffTypeViewModel)); _context.SaveChanges(); } }
private StaffTypeViewModel GetModel(StaffType stafftype) { StaffTypeViewModel staffViewModel = new StaffTypeViewModel() { Id = stafftype.Id, TypeDescription = stafftype.TypeDescription }; return(staffViewModel); }
private StaffType GetEntity(StaffTypeViewModel staffViewModel) { StaffType staffType = new StaffType() { Id = staffViewModel.Id, TypeDescription = staffViewModel.TypeDescription }; return(staffType); }
public StaffTypeViewModel GetStaffTypeById(int id) { StaffTypeViewModel staffType = null; using (var _context = new NasscomEntities()) { staffType = (from allstafftypes in _context.StaffType where allstafftypes.Id == id select GetModel(allstafftypes)).FirstOrDefault(); } return(staffType); }