/// <summary> /// Установить статусы текущего принятого вызова /// </summary> public void SetCurrentCallStates(CallDto activeCall) { if (activeCall == null || activeCall.Status != CallStatus.Start) { return; } CallId = activeCall.Id; ConnectionMode = activeCall.ConnectionMode.ToString(); if (activeCall.OnHold) { CurrentCallStates.Add(CallStatusDto.IsOnHold); } else { CurrentCallStates.Add(CallStatusDto.CallActive); } if (activeCall.IsMutedMicrophone) { CurrentCallStates.Add(CallStatusDto.IsMutedMicrophone); } if (activeCall.Isolated) { CurrentCallStates.Add(CallStatusDto.IsIsolated); } }
public async Task <CallDto> UpdateCall(int id, CallDto callDto) { using (CellularCompanyContext db = new CellularCompanyContext()) { try { if (id != callDto.CallId) { return(null); } else { Call call = db.Calls.FirstOrDefault(c => c.CallId == id); if (call == null) { return(null); } else { call = callDto.ToModel(); db.Entry(call).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); return(call.ToDto()); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); return(null); } } }
public async Task <CallDto> CreateCall(CallDto callDto) { using (CellularCompanyContext db = new CellularCompanyContext()) { try { if (callDto == null) { return(null); } else { db.Calls.Add(callDto.ToModel()); await db.SaveChangesAsync(); return(callDto); } } catch (Exception ex) { Debug.WriteLine(ex.Message); return(null); } } }
public static Call Map(CallDto dto) { return(new Call { NumberOfMinutes = dto.NumberOfMinutes, FeePerMinute = dto.FeePerMinute, }); }
public async Task <CallDto> CreateCall(CallDto call) { Task <CallDto> callDto; lock (_obj) { callDto = _callProvider.AddCall(call); } return(await callDto); }
private BaseCall MapCallDtoToCallVaccine(CallDto callVaccine) { return(new CallVaccine { Address = callVaccine.Address, Animal = _animalsRepository.GetById(callVaccine.AnimalId), Date = callVaccine.Date, Id = callVaccine.Id, Vaccine = _vaccinesRepository.GetById(callVaccine.WorkId) }); }
private BaseCall MapCallDtoToCallTreatment(CallDto callDto) { return(new CallTreatment { Address = callDto.Address, Animal = _animalsRepository.GetById(callDto.AnimalId), Date = callDto.Date, Id = callDto.Id, Treatment = _treatmentsRepository.GetById(callDto.WorkId) }); }
public static CallVm MapCallDtoToCallVm(CallDto callDto) { return(new CallVm { Address = callDto.Address, BreedName = callDto.BreedName, Date = callDto.Date, Id = callDto.Id, WorkName = callDto.WorkName, WorkType = callDto.WorkType }); }
public static Call ToModel(this CallDto callDto) { if (callDto == null) { return(null); } return(new Call { CallId = callDto.CallId, DestinationNumber = callDto.DestinationNumber, Duration = callDto.Duration, ExternalPrice = callDto.ExternalPrice, LineId = callDto.LineId, Line = callDto.Line.ToModel() }); }
private static CallDto MapBaseCallToDto(BaseCall call) { var callsDto = new CallDto { Address = call.Address, BreedName = call.Animal.Breed.Name, Date = call.Date, Id = call.Id, WorkType = call.WorkType.Name }; if (call is CallTreatment callTreatment) { callsDto.WorkName = callTreatment.Treatment.Name; } else if (call is CallVaccine callVaccine) { callsDto.WorkName = callVaccine.Vaccine.Name; } return(callsDto); }
public async Task <CallDto> UpdateCall(int callId, CallDto callDto) { return(await GetContainer().Resolve <ICallRepository>().UpdateCall(callId, callDto)); }
public async Task <CallDto> AddCall(CallDto dto) { return(await GetContainer().Resolve <ICallRepository>().CreateCall(dto)); }
public ResponseDto CreateVaccineCall([FromBody] CallDto callVaccineDto) { _callsRepository.CreateCall(MapCallDtoToCallVaccine(callVaccineDto)); return(new ResponseDto()); }
public ResponseDto CreateTreatmentCall([FromBody] CallDto callTreatmentDto) { _callsRepository.CreateCall(MapCallDtoToCallTreatment(callTreatmentDto)); return(new ResponseDto()); }
public static ResponseDto CreateTreatmentCall(CallDto callDto) { return(PostQuery(callDto, Constants.CREATE_TREATMENT_CALL)); }
public async Task <CallDto> AddCall(CallDto call) { return(await _invoiceProvider.CreateCall(call)); }
public static ResponseDto CreateVaccineCall(CallDto callDto) { return(PostQuery(callDto, Constants.CREATE_VACCINE_CALL)); }