public ActionResult Add(SampleModel drug) { SampleRepository r = new SampleRepository(); r.Add(drug); return(RedirectToAction("List")); }
public void EditSample(SampleDM sampleDM) { //Validate Service Domain Model SampleValidator sampleValidator = new SampleValidator(_GlobalErrors); sampleValidator.Validate(sampleDM); //Add to Global Errors if Validation Error exist if (_GlobalErrors.ErrorExist && !_GlobalErrors.ErrorHandled || !sampleDM.isValid) { _GlobalErrors.AddValidationError("Product addition Violation", "Violation Rule"); return; } //Continue the process if no validation error exist //... //... try { _Repository.Add(_Domain); }catch (Exception e) { _GlobalErrors.AddSystemError("Error in Product Addition"); _Logger.Error(e); } }
public void Get_AfterRequestToSampleRepository_ShouldReturnSample() { //Arrange var sample = new Sample() { SampleId = 1, Description = "Description_1", Name = "Name_1" }; var sampleRepo = new SampleRepository(_context); sampleRepo.Add(sample); //Act _context.SaveChanges(); var expectedSample = sampleRepo.Get(1); //Assert Assert.That(expectedSample, Is.Not.Null); Assert.That(expectedSample.Name, Is.EqualTo(sample.Name)); }
public void Generate(Dictionary <string, double[]> products) { SampleRepository s = new SampleRepository(); s.clear(); foreach (KeyValuePair <string, double[]> item in products) { _normalDestribution._mi = item.Value[0]; _normalDestribution._di = item.Value[1]; ArrayList l = new ArrayList(100); for (int j = 0; j < 100; j++) { l.Add(_normalDestribution.normalFunction()); } s.Add(new SampleItem { CurrentPrise = _normalDestribution._mi, StandardDeviation = _normalDestribution._di, Values = l }); } }