public void InsertOfficeOfRecord(OfficeOfRecordViewModel ovm) { OfficeOfRecord newRecord = new OfficeOfRecord { OOR_Id = ovm.Id, OOR_Name = ovm.Name?.Trim(), OOR_Code = ovm.Code?.Trim() }; context.OfficeOfRecords.Add(newRecord); context.SaveChanges(); }
public void UpdateOfficeOfRecord(OfficeOfRecordViewModel ovm) { OfficeOfRecord newRecord = new OfficeOfRecord { OOR_Id = ovm.Id, OOR_Name = ovm.Name, OOR_Code = ovm.Code }; context.OfficeOfRecords.Attach(newRecord); context.Entry(newRecord).State = EntityState.Modified; context.SaveChanges(); }
public void DeleteOfficeOfRecord(OfficeOfRecordViewModel ovm) { OfficeOfRecord newRecord = new OfficeOfRecord { OOR_Id = ovm.Id, OOR_Name = ovm.Name.Trim(), OOR_Code = ovm.Code.Trim() }; context.OfficeOfRecords.Attach(newRecord); context.OfficeOfRecords.Remove(newRecord); context.SaveChanges(); }