public void DeleteGuestBook(GuestBookViewModel GuestBook)
 {
     GuestBook entity = _guestBookRepository.GetById(GuestBook.Id);
     entity.Status = (int)DbConstant.DefaultDataStatus.Deleted;
     _guestBookRepository.Update(entity);
     _unitOfWork.SaveChanges();
 }
        public void InsertGuestBook(GuestBookViewModel guestBook, int userId)
        {
            DateTime serverTime = DateTime.Now;

            guestBook.CreateDate = serverTime;
            guestBook.CreateUserId = userId;
            guestBook.ModifyDate = serverTime;
            guestBook.ModifyUserId = userId;
            guestBook.Status = (int)DbConstant.DefaultDataStatus.Active;

            GuestBook entity = new GuestBook();
            Map(guestBook, entity);
            _guestBookRepository.AttachNavigation<Vehicle>(entity.Vehicle);
            _guestBookRepository.Add(entity);

            _unitOfWork.SaveChanges();
        }
        public void UpdateGuestBook(GuestBookViewModel guestBook, int userId)
        {
            DateTime serverTime = DateTime.Now;

            guestBook.ModifyDate = serverTime;
            guestBook.ModifyUserId = userId;

            GuestBook entity = _guestBookRepository.GetById(guestBook.Id);
            Map(guestBook, entity);

            _guestBookRepository.AttachNavigation<Vehicle>(entity.Vehicle);
            _guestBookRepository.Update(entity);

            _unitOfWork.SaveChanges();
        }