Пример #1
0
 public int CreateSubCategory(BusinessEntities.SubCategoryMasterEntity SubCategoryMasterEntity)
 {
     using (var scope = new TransactionScope())
     {
         var city = new SubCategoryMaster
         {
             CategoryName = SubCategoryMasterEntity.CategoryName,
             IsActive     = Convert.ToBoolean(SubCategoryMasterEntity.IsActive),
             CreateDate   = Convert.ToDateTime(SubCategoryMasterEntity.CreateDate)
         };
         _unitOfWork.SubCategoryMasterRepository.Insert(city);
         _unitOfWork.Save();
         scope.Complete();
         return(city.PK_SubCategoryId);
     }
 }
Пример #2
0
        public BusinessEntities.SubCategoryMasterEntity GetSubCategoryById(int id)
        {
            BusinessEntities.SubCategoryMasterEntity objSubCategoryMaster = new BusinessEntities.SubCategoryMasterEntity();
            if (id == 0)
            {
                return(objSubCategoryMaster);
            }

            var city = _unitOfWork.SubCategoryMasterRepository.GetByID(id);

            if (city != null)
            {
                Mapper.CreateMap <SubCategoryMaster, SubCategoryMasterEntity>();
                var subcategoryModel = Mapper.Map <SubCategoryMaster, SubCategoryMasterEntity>(city);
                return(subcategoryModel);
            }
            return(null);
        }
Пример #3
0
        public bool UpdateSubCategory(int id, BusinessEntities.SubCategoryMasterEntity SubCategoryMasterEntity)
        {
            var success = false;

            if (SubCategoryMasterEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var city = _unitOfWork.SubCategoryMasterRepository.GetByID(id);
                    if (city != null)
                    {
                        city.CategoryName = SubCategoryMasterEntity.CategoryName;
                        city.IsActive     = Convert.ToBoolean(SubCategoryMasterEntity.IsActive);
                        city.CreateDate   = Convert.ToDateTime(SubCategoryMasterEntity.CreateDate);

                        _unitOfWork.SubCategoryMasterRepository.Update(city);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }