示例#1
0
        public SubCategorysMasterUI Add(SubCategorysMasterUI Entity)
        {
            var building = Mapper.Map <SubCategorysMasterUI, SubCategorysMaster>(Entity);

            //building.SiteMaster = _unitOfWork.SiteMastersRepository.GetByID(Entity.SiteId);
            _unitOfWork.SubCategorysMasterRepository.Insert(building);
            _unitOfWork.Save();
            if (building != null)
            {
                var taskModel = Mapper.Map <SubCategorysMaster, SubCategorysMasterUI>(building);
                return(taskModel);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        public bool Delete(long Id, string basePath, SubCategorysMasterUI Entity)
        {
            if (Id > 0)
            {
                //_unitOfWork.bank.Delete(Id);
                var building = _unitOfWork.SubCategorysMasterRepository.GetByID(Id);
                building.ModifiedBy   = Entity.MBy;
                building.ModifiedDate = Entity.MDt;
                building.Status       = RecordStatus.Deleted;
                _unitOfWork.SubCategorysMasterRepository.Update(building);
                _unitOfWork.Save();

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 public SubCategorysMasterUI Update(long id, SubCategorysMasterUI Entity)
 {
     //var bank = _unitOfWork.SubCategorysMasterRepository.GetByID(id);
     //if (bank != null)
     {
         var requestModel = Mapper.Map <SubCategorysMasterUI, SubCategorysMaster>(Entity);
         requestModel.PK_Id = id;
         //  requestModel.SiteMaster = _unitOfWork.SiteMastersRepository.GetByID(Entity.SiteId);
         _unitOfWork.SubCategorysMasterRepository.Update(requestModel);
         _unitOfWork.Save();
         if (requestModel != null)
         {
             var taskModel = Mapper.Map <SubCategorysMaster, SubCategorysMasterUI>(requestModel);
             return(taskModel);
         }
         else
         {
             return(null);
         }
     }
 }
示例#4
0
        public bool IsDuplicateBuilding(SubCategorysMasterUI building)
        {
            //FilterDefinitionBuilder<SubCategorysMaster> builder = Builders<SubCategorysMaster>.Filter;
            var filter = PredicateBuilder.Create <SubCategorysMaster>(s =>
                                                                      s.Status == RecordStatus.Active && s.CategoryId == building.CID &&
                                                                      s.Name.ToLower() == building.Name.ToLower());

            //&& s.ShopId == building.SI
            if (building.UIDN > 0)
            {
                filter = filter.And(a => a.PK_Id != building.UIDN);
            }

            var existsunit = _unitOfWork.SubCategorysMasterRepository.Getnotrack(filter);

            if (existsunit != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }