public void DeleteSPKSchedule(SPKScheduleViewModel SPKSchedule)
        {
            SPKSchedule entity = _SPKScheduleRepository.GetById(SPKSchedule.Id);

            entity.Status = (int)DbConstant.DefaultDataStatus.Deleted;
            _SPKScheduleRepository.Update(entity);
            _unitOfWork.SaveChanges();
        }
        public void InsertSPKSchedule(SPKScheduleViewModel SPKSchedule, int userId)
        {
            DateTime serverTime = DateTime.Now;

            SPKSchedule.CreateUserId = userId;
            SPKSchedule.ModifyDate   = serverTime;
            SPKSchedule.ModifyUserId = userId;
            SPKSchedule.Status       = (int)DbConstant.DefaultDataStatus.Active;
            SPKSchedule entity = new SPKSchedule();

            Map(SPKSchedule, entity);
            _SPKScheduleRepository.AttachNavigation <SPK>(entity.SPK);
            _SPKScheduleRepository.AttachNavigation <Mechanic>(entity.Mechanic);
            _SPKScheduleRepository.Add(entity);
            _unitOfWork.SaveChanges();
        }
        public void UpdateSPKSchedule(SPKScheduleViewModel SPKSchedule, int userId)
        {
            DateTime serverTime = DateTime.Now;

            SPKSchedule entity = _SPKScheduleRepository.GetById(SPKSchedule.Id);

            entity.ModifyDate   = serverTime;
            entity.ModifyUserId = userId;
            entity.Date         = SPKSchedule.Date;
            entity.Description  = SPKSchedule.Description;
            entity.SPKId        = SPKSchedule.SPKId;
            entity.MechanicId   = SPKSchedule.MechanicId;

            //Map(SPKSchedule, entity);
            //_SPKScheduleRepository.AttachNavigation<Mechanic>(entity.Mechanic);
            //_SPKScheduleRepository.AttachNavigation<SPK>(entity.SPK);

            _SPKScheduleRepository.Update(entity);
            _unitOfWork.SaveChanges();
        }