public void ComponentRepository_Create_Success() { Course course = new Course() { Name = "Kvantna računala", NaturalIdentifier = "KVARC-FER-2016", EctsCredits = 5, Components = null, LecturersInCharge = null, StudentsEnrolled = null }; var savedCourse = _corRep.Create(course); Component component = new Component() { Course = savedCourse, Name = "Seminari", MaximumPoints = 40, MinimumPointsToPass = 20 }; var created = _comRep.Create(component); Assert.IsNotNull(created); Assert.AreEqual(created.Name, "Seminari"); }
public Component Post(ComponentDTO value) { Component model = new Component() { ProviderId = value.ProviderId, Name = value.Name, Price = value.Price, Quantity = value.Quantity }; return(IComponentRepository.Create(model)); }
public Component Post(ComponentDTO value) { Component model = new Component() { ManufacturerId = value.ManufacturerId, Name = value.Name, Price = value.Price, Quantity = value.Quantity, Status = value.Status, Image = value.Image }; return(IComponentRepository.Create(model)); }
public Component CreateComponent(string name, int courseId, float minPointsToPass, float maxPoints) { var course = _courseRepository.GetById(courseId); if (course == null) { return(null); } var component = new Component() { Name = name, Course = course, MinimumPointsToPass = minPointsToPass, MaximumPoints = maxPoints }; return(_componentRepository.Create(component)); }
public async Task <Component> Create(Component model) { var createdId = await _componentRepository.Create(model); return(await _componentRepository.Read(createdId)); }