public async Task <SelectedNumberDto> UpdateSelectedNumber(int id, SelectedNumberDto selectedNumberDto) { using (CellularCompanyContext db = new CellularCompanyContext()) { if (id != selectedNumberDto.SelectedNumberId) { return(null); } else { var sn = db.SelectedNumbers.FirstOrDefault(s => s.SelectedNumberId == id); if (sn == null) { return(null); } else { SelectedNumbers selectedNumber = selectedNumberDto.ToModel(); db.Entry(selectedNumber).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); return(sn.ToDto()); } } } }
public async Task <LineDto> CreateLine(LineDto lineDto, SelectedNumberDto selectedNumberDto) { using (CellularCompanyContext db = new CellularCompanyContext()) { try { if (lineDto == null) { return(null); } else { lineDto.SelectedNumbers = selectedNumberDto; db.Lines.Add(lineDto.ToModel()); await db.SaveChangesAsync(); return(lineDto); } } catch (Exception ex) { Debug.WriteLine(ex.Message); return(null); } } }
public async Task <LineDto> AddLine(LineDto newLine, SelectedNumberDto newSelectedNumber) { Task <LineDto> lineDto; lock (_obj) { lineDto = _lineProvider.AddLine(newLine, newSelectedNumber); } return(await lineDto); }
public static SelectedNumbers ToModel(this SelectedNumberDto selectedNumberDto) { if (selectedNumberDto == null) { return(null); } return(new SelectedNumbers { SelectedNumberId = selectedNumberDto.SelectedNumberId, FirstNumber = selectedNumberDto.FirstNumber, SecondNumber = selectedNumberDto.SecondNumber, ThirdNumber = selectedNumberDto.ThirdNumber, Line = selectedNumberDto.Line.ToModel() }); }
public async Task <SelectedNumberDto> CreateSelectedNumber(SelectedNumberDto selectedNumberDto) { using (CellularCompanyContext db = new CellularCompanyContext()) { if (selectedNumberDto == null) { return(null); } else { db.SelectedNumbers.Add(selectedNumberDto.ToModel()); await db.SaveChangesAsync(); return(selectedNumberDto); } } }
//ctor public LineViewModel(INavigationService navigationService) { try { _navigationService = navigationService; SelectedLine = new LineDto(); Line = new LineDto(); PackageIncludes = new PackageIncludeDto(); SelectedNumbers = new SelectedNumberDto(); Lines = new CustomObservableCollection <LineDto>(); InitializeObservableCollections(); InitializeCommands(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public async Task <bool> AddFullLine(LineDto line, PackageIncludeDto packageInclude, SelectedNumberDto selectedNumber, CustomerDto customer) { return(await _CRMProvider.AddFullLine(line, packageInclude, selectedNumber, customer)); }
public async Task <LineDto> AddLine(LineDto lineDto, SelectedNumberDto selectedNumberDto) { return(await GetContainer().Resolve <ILineRepository>().CreateLine(lineDto, selectedNumberDto)); }
public async Task <SelectedNumberDto> UpdateSelectedNumber(int id, SelectedNumberDto selectedNumberDto) { return(await GetContainer().Resolve <ISelectedNumberRepository>().UpdateSelectedNumber(id, selectedNumberDto)); }
public async Task <SelectedNumberDto> AddSelectedNumber(SelectedNumberDto selectedNumberDto) { return(await GetContainer().Resolve <ISelectedNumberRepository>().CreateSelectedNumber(selectedNumberDto)); }