コード例 #1
0
 public void Save(StaffTypeViewModel staffTypeViewModel)
 {
     using (var _context = new NasscomEntities())
     {
         _context.StaffType.Add(GetEntity(staffTypeViewModel));
         _context.SaveChanges();
     }
 }
コード例 #2
0
        private StaffTypeViewModel GetModel(StaffType stafftype)
        {
            StaffTypeViewModel staffViewModel = new StaffTypeViewModel()
            {
                Id = stafftype.Id,
                TypeDescription = stafftype.TypeDescription
            };

            return(staffViewModel);
        }
コード例 #3
0
        private StaffType GetEntity(StaffTypeViewModel staffViewModel)
        {
            StaffType staffType = new StaffType()
            {
                Id = staffViewModel.Id,
                TypeDescription = staffViewModel.TypeDescription
            };

            return(staffType);
        }
コード例 #4
0
        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);
        }