/// <summary> /// Gets the constructor. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public ConstructorInfo GetConstructor(Type type) { if (!_typesRepository.Exist(type)) { _typesRepository.Add(type); } return(_typesRepository.GetConstructor(type)); }
public void Add(TypesCreateModel type) { if (!_typesRepository.Add(new Models.Type(type))) { throw new ApplicationException(); } }
public void Add_Valid_Test() { var model = new Models.Type() { ID = 2, Description = "Tirowe" }; if (_typesRepository.Add(model)) { var modelResponde = _applicationDbContext.Types.FirstOrDefault(t => t.ID == model.ID); Assert.IsNotNull(modelResponde); Assert.AreEqual(modelResponde.Description, model.Description); return; } Assert.Fail(); }
public TypeModel Add(TypeEntity entity) { var product = _repository.Add(entity); return(new TypeModel { Id = product.Id, Name = product.Name, //ProductEntity = product.ProductEntity }); }
public IActionResult Add(AddCustomerDto customerDto) { if (ModelState.IsValid) { Customer customer = _mapper.Map <Customer>(customerDto); _customerRepository.Add(customer); foreach (int cType in customerDto.CustomerTypes) { CustomerTypeCustomer customerTypeCustomer = new CustomerTypeCustomer { Customer = customer, CustomerTypeId = cType }; _customerTypeCustomerRepository.Add(customerTypeCustomer); } return(RedirectToAction("Index")); } TempData["CustomerTypes"] = _customerTypes; return(View(customerDto)); }
public void Add(Types types) { typesRepository.Add(types); }