public ActionResult Edit(int id, ReportingParty reportingParty) { try { _dbReportingPartyRepository.Update(reportingParty); return(RedirectToAction("Index")); } catch { return(View(reportingParty)); } }
public ActionResult Create(ReportingParty reportingParty) { try { _dbReportingPartyRepository.Insert(reportingParty); return(RedirectToAction("Index")); } catch { return(View(reportingParty)); } }
public ICollection <ReportingParty> GetData() { var command = _dbReportingPartyCommandProvider.GetGetDataDbCommand(); command.Connection = _dbConnHolder.Connection; _dbConnHolder.Open(); var entList = new Collection <ReportingParty>(); var reader = new SafeDataReader(command.ExecuteReader(CommandBehavior.CloseConnection)); while (reader.Read()) { var tempEntity = new ReportingParty(reader.GetInt32("Id"), reader.GetString("Name"), reader.GetString("Email"), reader.GetString("Phone"), reader.GetNullableInt32("PhoneTypeId")); entList.Add(tempEntity); } reader.Close(); return(entList); }
public PagedResult <ReportingParty> GetDataPageable(string sortExpression, int page, int pageSize) { var command = _dbReportingPartyCommandProvider.GetGetDataPageableDbCommand(sortExpression, page, pageSize); command.Connection = _dbConnHolder.Connection; _dbConnHolder.Open(); var entList = new Collection <ReportingParty>(); var reader = new SafeDataReader(command.ExecuteReader(CommandBehavior.CloseConnection)); while (reader.Read()) { var tempEntity = new ReportingParty(reader.GetInt32("Id"), reader.GetString("Name"), reader.GetString("Email"), reader.GetString("phone"), reader.GetNullableInt32("phoneTypeId")); entList.Add(tempEntity); } reader.Close(); var totalCount = GetRowCount(); var pagedResults = new PagedResult <ReportingParty>(page, pageSize, totalCount, entList); return(pagedResults); }
public void Update_Should_Update_A_ReportingParty() { _repository .Setup( it => it.Update(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int?>(), It.IsAny <string>(), It.IsAny <int?>(), It.IsAny <int>())) .Callback <string, string, string, int?, string, int?, int>( (name, email, phone, phoneTypeId, phone2, phone2TypeId, id) => { var tReportingParty = _repositoryList.Find(x => x.Id == id); tReportingParty.Name = name; tReportingParty.Email = email; tReportingParty.phone = phone; tReportingParty.phoneTypeId = phoneTypeId; tReportingParty.Phone2 = phone2; tReportingParty.Phone2TypeId = phone2TypeId; }); var tempReportingParty = _repositoryList.Find(x => x.Id == id); var testReportingParty = new ReportingParty { Id = tempReportingParty.Id, Name = tempReportingParty.Name, Email = tempReportingParty.Email, phone = tempReportingParty.phone, phoneTypeId = tempReportingParty.phoneTypeId, Phone2 = tempReportingParty.Phone2, Phone2TypeId = tempReportingParty.Phone2TypeId }; //TODO change something on testReportingParty //testReportingParty.oldValue = newValue; _target.Update(testReportingParty); //Assert.AreEqual(newValue, _repositoryList.Find(x => x.Id==1).oldValue); //TODO fail until we update the test above Assert.Fail(); }
public int Insert(ReportingParty reportingParty) { return(_dbRepository.Insert(reportingParty.Name, reportingParty.Email, reportingParty.phone, reportingParty.phoneTypeId)); }
public void Update(ReportingParty reportingParty) { _dbRepository.Update(reportingParty.Name, reportingParty.Email, reportingParty.phone, reportingParty.phoneTypeId, reportingParty.Id); }
public void Delete(ReportingParty reportingParty) { Delete(reportingParty.Id); }