public static int?UpdateOffice(Office office) { if (office == null) { throw new System.ArgumentNullException() { Source = "office" }; } using (CustomClearviewEntities ctx = new CustomClearviewEntities()) { OfficeRepository repo = new OfficeRepository(ctx); Office o = GetOffice(office.OfficeId); o.VendorId = office.VendorId; o.OfficeName = office.OfficeName; o.OfficeEmail = office.OfficeEmail; o.MarketerCode = office.MarketerCode; o.IsActive = office.IsActive; o.ModifiedBy = office.ModifiedBy; o.ModifiedDateTime = office.ModifiedDateTime; repo.Update(o); ctx.SaveChanges(); } return(office.OfficeId); }
///<inheritdoc/> public override void Handle(BrokeredMessage message) { var officeRepository = new OfficeRepository(new MyCompanyContext()); var dto = message.GetBody <OfficeDTO>(); var office = Mapper.Map <Office>(dto); officeRepository.Update(office); }
public void OfficeRepository_UpdateOffice_NotFail_Test() { var context = new MyCompanyContext(); var office = context.Offices.FirstOrDefault(); var target = new OfficeRepository(context); office.CalendarId = context.Calendars.FirstOrDefault().CalendarId; target.Update(office); }