private void AddHaciendaTo(IPlayer player) { Role.CleanUp(); var hacienda = new Hacienda(); hacienda.AddWorker(new Colonist()); player.Build(hacienda); ReselectRole(player); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(BadRequest()); } HaciendaModel = await _haciendaService.GetByIdAsync(id); if (HaciendaModel == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(BadRequest()); } HaciendaModel = await _haciendaService.GetByIdAsync(id); if (HaciendaModel != null) { await _haciendaService.Delete(HaciendaModel); } return(RedirectToPage("./Index")); }
public async Task Update(Hacienda hacienda) { var spec = new HaciendaWithSpecification(hacienda.Codigo); var existeCod = await _haciendaRepo.GetEntityWithSpecAsync(spec); if (existeCod != null && existeCod.Id != hacienda.Id) { throw new System.Exception("Ya existe un registro con ese Código"); } try { _haciendaRepo.Update(hacienda); await _haciendaRepo.SaveChangesAsync(); } catch (System.Exception ex) { throw (ex); } }
public async Task Delete(Hacienda hacienda) { _haciendaRepo.Remove(hacienda); await _haciendaRepo.SaveChangesAsync(); }