public long InsertOrUpdateCall(Call call) { StartDataEndDateValidate(call); try { callRepository.InsertOrUpdateCall(call); return call.CallID; } catch (Exception ex) { throw ex; } }
public long InsertOrUpdateCall(Call call) { try { context.Entry(call).State = call.CallID == 0 ? EntityState.Added : EntityState.Modified; SaveChanges(); return call.CallID; } catch (Exception ex) { throw ex; } }
private void StartDataEndDateValidate(Call call) { if (call.DateStart > call.DateEnd) { throw new InvelidDateException(String.Format("End Date and Time must be greater than Start Date and Time ")); } }