public void Update(ProcedureCell model) { var cell = this.context.ProceduresCells.Find(model.Id); cell.ProcedureTypeLeftId = model.ProcedureTypeLeftId; cell.ProcedureTypeRightId = model.ProcedureTypeRightId; cell.ProcedureTypeTopId = model.ProcedureTypeTopId; cell.ProcedureTypeBottomId = model.ProcedureTypeBottomId; cell.ProcedureTypeCenterId = model.ProcedureTypeCenterId; this.context.SaveChanges(); }
private void AddC(object obj) { if (this.cellId != 0) { if (this.TypeProcedure != null) { var toot = this.procedureCellService.GetById(this.cellId); switch (ToothOrient) { case 1: { toot.ProcedureTypeLeftId = this.TypeProcedure.Id; break; } case 2: { toot.ProcedureTypeTopId = this.TypeProcedure.Id; break; } case 3: { toot.ProcedureTypeRightId = this.TypeProcedure.Id; break; } case 4: { toot.ProcedureTypeBottomId = this.TypeProcedure.Id; break; } case 5: { toot.ProcedureTypeCenterId = this.TypeProcedure.Id; break; } } this.procedureCellService.Update(toot); } else { var toot = this.procedureCellService.GetById(this.cellId); switch (ToothOrient) { case 1: { toot.ProcedureTypeLeftId = null; break; } case 2: { toot.ProcedureTypeTopId = null; break; } case 3: { toot.ProcedureTypeRightId = null; break; } case 4: { toot.ProcedureTypeBottomId = null; break; } case 5: { toot.ProcedureTypeCenterId = null; break; } } this.procedureCellService.Update(toot); } } else if (this.typeProcedure != null) { var toot = new ProcedureCell { Date = new DateTime(this.year, 1, 1), TableId = this.patientId, Tooth = this.tooth }; switch (ToothOrient) { case 1: { toot.ProcedureTypeLeftId = this.TypeProcedure.Id; break; } case 2: { toot.ProcedureTypeTopId = this.TypeProcedure.Id; break; } case 3: { toot.ProcedureTypeRightId = this.TypeProcedure.Id; break; } case 4: { toot.ProcedureTypeBottomId = this.TypeProcedure.Id; break; } case 5: { toot.ProcedureTypeCenterId = this.TypeProcedure.Id; break; } } this.procedureCellService.Add(toot); } }
public void Add(ProcedureCell model) { this.context.ProceduresCells.Add(model); this.context.SaveChanges(); }