public async Task <IActionResult> Edit(int id, [Bind("PersonID,Name,Count")] Person person) { if (id != person.PersonID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.PersonID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(person)); }
protected override async Task <int> HandleCore(ActualizeazaSectieCommand message) { try { var formular = await _context.PollingStationInfos .FirstOrDefaultAsync(a => a.IdObserver == message.IdObservator && a.IdPollingStation == message.IdSectieDeVotare); if (formular == null) { throw new ArgumentException("PollingStationInfo nu exista"); } _mapper.Map(message, formular); _context.Update(formular); return(await _context.SaveChangesAsync()); } catch (Exception ex) { _logger.LogError(new EventId(), ex.Message); } return(-1); }
public async Task <int> Handle(ActualizeazaSectieCommand message) { try { var formular = await _context.RaspunsFormular .FirstOrDefaultAsync(a => a.IdObservator == message.IdObservator && a.IdSectieDeVotare == message.IdSectieDeVotare); if (formular == null) { throw new ArgumentException("RaspunsFormular nu exista"); } _mapper.Map(message, formular); _context.Update(formular); return(await _context.SaveChangesAsync()); } catch (Exception ex) { _logger.LogError(new EventId(), ex.Message); } return(-1); }