Esempio n. 1
0
        public void InsertSparepart(SparepartViewModel sparepart, int userId)
        {
            DateTime serverTime = DateTime.Now;

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

            Map(sparepart, entity);
            _sparepartRepository.AttachNavigation(entity.CreateUser);
            _sparepartRepository.AttachNavigation(entity.ModifyUser);
            _sparepartRepository.AttachNavigation(entity.CategoryReference);
            _sparepartRepository.AttachNavigation(entity.UnitReference);
            _sparepartRepository.Add(entity);
            _unitOfWork.SaveChanges();
        }