public static int AddAppointment(customersInLine turn) { try { using (onLineEntities1 entities = new onLineEntities1()) { entities.customersInLines.Add(turn); entities.SaveChanges(); return(turn.TurnId); } } catch (Exception) { throw; } }
public static void UpdateTurns(List <customersInLine> line) { try { using (onLineEntities1 entities1 = new onLineEntities1()) { for (int i = 0; i < line.Count(); i++) { customersInLine turn = entities1.customersInLines.FirstOrDefault(l => l.TurnId == line[i].TurnId); turn.estimatedHour = line[i].estimatedHour; turn.isActive = line[i].isActive; } entities1.SaveChanges(); } } catch (Exception) { throw; } }
public static void UpdateTurn(customersInLine turnToUpdate) { try { using (onLineEntities1 entities1 = new onLineEntities1()) { customersInLine turn = entities1.customersInLines.FirstOrDefault(l => l.TurnId == turnToUpdate.TurnId); turn.preAlert = turnToUpdate.preAlert; turn.statusTurn = turnToUpdate.statusTurn; turn.verificationCode = turnToUpdate.verificationCode; turn.actualHour = turnToUpdate.actualHour; turn.exitHour = turnToUpdate.exitHour; // entities1.Entry(turnToUpdate).State = EntityState.Modified; entities1.SaveChanges(); } } catch (Exception) { throw; } }