public void Add(Category entity) { entity.Username = common.GetCurrentUsername(); categoryRepository.Add(entity); Save(); }
public void Add(Category category) { categoryRepository.Add(category); }
public void CreateCategory(Category category) { _categoryRepository.Add(category); SaveCategory(); }
public async Task <Guid> Add(AddCategoryViewModel model) { return(await _categoryRepository.Add(model)); }
public void CreateCategory(CategoryViewModel categoryDTO) { var category = Mapper.Map <CategoryViewModel, Category>(categoryDTO); categorysRepository.Add(category); }
public async Task <Category> Add([FromBody] CategoryInput category) { return(await repo.Add(category)); }
public (string, Category) Post([FromBody] Category category) { _db.Add(category); return($"/api/categories/{category.Id}", category); }
protected override void Preparation() { m_CategoryRepository = ObjectFactory.GetInstance<ICategoryRepository>(); m_Category = new Category { Id = 0, Name = "Figur", Description = "Alle Figuren" }; m_Id = m_CategoryRepository.Add(m_Category); m_Category = m_CategoryRepository.GetById(m_Id); m_Category.Name = "Test"; m_Category.Description = "Test"; Because(); }
public ActionResult Edit(int Id, string name, string desc, string descSec, decimal price, string cat, double disc, HttpPostedFileBase image) { var viewModel = new ProductViewModel { Id = Id, Name = name, Category = cat, Description = desc, DescriptionSecond = descSec, Price = price, }; var masterModel = new MasterPageModel(); _categoryRepository.GetAll(); if (ModelState.IsValid) { if (image != null) { viewModel.ImageMimeType = image.ContentType; viewModel.ImageData = new byte[image.ContentLength]; image.InputStream.Read(viewModel.ImageData, 0, image.ContentLength); } else { var tmp = _repository.Get(p => p.Id == viewModel.Id); viewModel.ImageData = tmp.ImageData; viewModel.ImageMimeType = tmp.ImageMimeType; } var product = new Product(); if (_create) { viewModel.ProductViewModelToEntity(product, _categoryRepository, _unitOfWork); _repository.Add(product); } else { product = _repository.Get(p => p.Id == viewModel.Id); viewModel.ProductViewModelToProductEntity(product); var category = product.Category; if (category.Name != viewModel.Category) { var newCategory = _categoryRepository.Get(c => c.Name == viewModel.Category); if (newCategory != null) { product.Category = newCategory; } else { var tmp = new Category { Name = viewModel.Category }; _categoryRepository.Add(tmp); _unitOfWork.Commit(); product.Category = tmp; } _unitOfWork.Commit(); } _repository.Update(product); } _unitOfWork.Commit(); TempData["Message"] = string.Format("{0} has been saved", product.Name); return(RedirectToAction("Index")); } else { masterModel.ProductView = viewModel; return(View(masterModel)); } }
public ResultMessage <Category> Add(Category data) { return(repository.Add(data)); }
public async Task AddToDb(Category category) { await _categoryRepository.Add(category); }
public int AddCategory(Category category) { _categoryRepository.Add(category); return(category.Id); }
public void Add(CategoryDTO categoryDTO) { var category = Mapper.Map <Category> (categoryDTO); _categoryRepository.Add(category); }
public void CreateCategory(CategoryDto categoryDto) { //var category = categoryDto.MappingCategory(); categoryRepository.Add(categoryDto.MappingCategory()); }
public Category PostCategories(Category category) { return(repository.Add(category)); }
public bool Add(Category category) { return(_repo.Add(category)); }
public void Store(CategoryDto categoryDto) { var category = new Category(categoryDto.name); CategoryRepository.Add(category); }
public CategoryDTO Add(CategoryDTO categoryDTO) { var category = categoryDTO.ToModel(); category.Id = IdentityGenerator.NewSequentialGuid(); category.Created = DateTime.UtcNow; if (category.Parent == null || category.Parent.Id == Guid.Empty) { category.Depth = 1; } else { category.Parent = _Repository.Get(categoryDTO.Parent.Id); category.Depth = category.Parent.Depth + 1; } if (category.Name.IsNullOrBlank()) { throw new DefinedException(CommonMessageResources.Name_Empty); } if (_Repository.Exists(category)) { throw new DataExistsException(string.Format(BaseMessagesResources.Category_Exists_WithValue, category.Name)); } if (category.Parent != null) { var rulePrefix = category.Parent.ChildSnRulePrefix; if (rulePrefix.IsNullOrBlank()) { throw new DefinedException(BaseMessagesResources.Category_Parent_SerialNumberRule_Prefix_Empty); } var ruleNumberLength = category.Parent.ChildSnRuleNumberLength; if (ruleNumberLength <= 0) { throw new DefinedException(BaseMessagesResources.Category_Parent_SerialNumberRule_NumberLength_NotGreat_Than_Zero); } category.Sn = SerialNumberGenerator.GetSerialNumber(rulePrefix, false, ruleNumberLength); } else { var ruleName = CommonMessageResources.SerialNumberRule_Category; var snRule = SerialNumberRuleQuerier.FindBy(ruleName); if (snRule == null) { throw new DataNotFoundException(string.Format(BaseMessagesResources.SerialNumberRule_NotExists_WithValue, ruleName)); } category.Sn = SerialNumberGenerator.GetSerialNumber(snRule.Prefix, snRule.UseDateNumber, snRule.NumberLength); } _Repository.Add(category); #region 操作日志 var categoryDto = category.ToDto(); OperateRecorder.RecordOperation(categoryDto.Sn, BaseMessagesResources.Add_Category, categoryDto.GetOperationLog()); #endregion //commit the unit of work _Repository.UnitOfWork.Commit(); return(category.ToDto()); }
public void Add(Category obj) { _repository.Add(obj); }
public bool Add(CategoryDTO category) { var categoryEntity = mapper.Map <CategoryDTO, Category>(category); return(_categoryRepository.Add(categoryEntity)); }
public ServiceResult Add(Category category) { category.Id = default; _categoryRepository.Add(category); return(ServiceResult.Success()); }
public async Task <int> Add(Category entity) { var category = Mapper.Map <Category, CategoryDAOEntity>(entity); return(await _categoryRepository.Add(category)); }
public Category Add(Category entity) { return(_categoryRepository.Add(entity)); }
public void CreateCategory(Category category) { _categoryRepository.Add(category); _unitOfWork.Commit(); }
public void Add(Category entity) { categoryRepository.Add(entity); }
public void Insert(CategoryViewModel ViewModel) { _repository.Add(_mapper.Map <Category>(ViewModel)); }
public async Task <ActionResult> Post(Category category) { await categoryRepository.Add(category); return(CreatedAtAction("Get", new { id = category.Id }, category)); }
public void CreateCategory(Category category) { categorysRepository.Add(category); }
public void Add(CategoryDTO entity) { _categoryRepository.Add(entity); }
public void Insert(Category entity) { _categoryRepository.Add(entity); }
public Category Post(Category category) { return(categoryRepository.Add(category)); }