Example #1
0
 public int CreateCategory(BusinessEntities.CategoryMasterEntity CategoryMasterEntity)
 {
     using (var scope = new TransactionScope())
     {
         var city = new CategoryMaster
         {
             CityName     = CategoryMasterEntity.CityName,
             DistrictName = CategoryMasterEntity.DistrictName,
             StateName    = CategoryMasterEntity.StateName.ToString()
         };
         _unitOfWork.CategoryMasterRepository.Insert(city);
         _unitOfWork.Save();
         scope.Complete();
         return(city.PK_ID);
     }
 }
 public int CreateCategory(BusinessEntities.CategoryMasterEntity CategoryMasterEntity)
 {
     using (var scope = new TransactionScope())
     {
         var city = new CategoryMaster
         {
             CategoryName = CategoryMasterEntity.CategoryName,
             IsActive     = Convert.ToBoolean(CategoryMasterEntity.IsActive),
             CreateDate   = Convert.ToDateTime(CategoryMasterEntity.CreateDate)
         };
         _unitOfWork.CategoryMasterRepository.Insert(city);
         _unitOfWork.Save();
         scope.Complete();
         return(city.PK_CategoryId);
     }
 }
Example #3
0
        public BusinessEntities.CategoryMasterEntity GetCategoryById(int id)
        {
            BusinessEntities.CategoryMasterEntity objCategoryMaster = new BusinessEntities.CategoryMasterEntity();
            if (id == 0)
            {
                return(objCategoryMaster);
            }

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

            if (city != null)
            {
                Mapper.CreateMap <CategoryMaster, CategoryMasterEntity>();
                var categoryModel = Mapper.Map <CategoryMaster, CategoryMasterEntity>(city);
                return(categoryModel);
            }
            return(null);
        }
Example #4
0
        public bool UpdateCategory(int id, BusinessEntities.CategoryMasterEntity CategoryMasterEntity)
        {
            var success = false;

            if (CategoryMasterEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var city = _unitOfWork.CategoryMasterRepository.GetByID(id);
                    if (city != null)
                    {
                        city.CityName     = CategoryMasterEntity.CityName;
                        city.DistrictName = CategoryMasterEntity.DistrictName;
                        city.StateName    = CategoryMasterEntity.StateName.ToString();

                        _unitOfWork.CategoryMasterRepository.Update(city);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
        public bool UpdateCategory(int id, BusinessEntities.CategoryMasterEntity CategoryMasterEntity)
        {
            var success = false;

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

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