public async Task <CompanyEntity> Update(UpdateCompanyCmd cmd) { var evt = CompanyUpdatedEvt.MakeEventEntity(cmd); var insertions = await eventRepository.Create(evt); return(await db.FirstAsync(c => c.Id == cmd.Id)); }
public CompanyUpdatedEvt(UpdateCompanyCmd cmd) { Id = cmd.Id; Name = cmd.Name; Activity = cmd.Activity; Url = cmd.Url; }
public static EventEntity MakeEventEntity(UpdateCompanyCmd cmd) { return(new EventEntity { UserId = cmd.UserId, Body = new CompanyUpdatedEvt(cmd) }); }
public async Task <IActionResult> Update(long id, [FromBody] UpdateCompanyReq req) { var updateCmd = new UpdateCompanyCmd(id, req, HttpContext.UserId().Value); var company = await companyRepo.Update(updateCmd); return(Ok(new CompanyResult(company))); }