public async Task AddOrUpdate(DomainContextDto dto) { if (string.IsNullOrEmpty(dto.Id)) { await Create(dto); } else { await Update(dto); } }
internal DomainContextEntity BuildDto(DomainContextDto dto) { this.Id = dto.Id; this.Organization = dto.Organization; this.Domain = dto.Domain; this.Context = dto.Context; this.Key = dto.Key; this.Description = dto.Description; this.UserRegister = dto.UserRegister; return(this); }
public async Task <ActionResult> Edit(DomainContextDto dto) { try { await this._domainContextService.AddOrUpdate(dto); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
private async Task <bool> Create(DomainContextDto dto) { var result = true; try { await this._domainContextRepository.Create(new DomainContextEntity().BuildDto(dto)); } catch (Exception) { result = false; } return(result); }
public async Task <DomainContextDto> Find(string id) { DomainContextDto result; try { var entity = (await this._domainContextRepository.Get(x => x.Id.Equals(id))).FirstOrDefault(); result = new DomainContextDto(entity); } catch (Exception) { result = new DomainContextDto(); } return(result); }
// GET: DomainContextController/Edit/5 public async Task <ActionResult> Edit(string id) { DomainContextDto result = await this._domainContextService.Find(id); return(View(result.SetEmail(NameContext()))); }