Example #1
0
        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));
        }
Example #2
0
 public CompanyUpdatedEvt(UpdateCompanyCmd cmd)
 {
     Id       = cmd.Id;
     Name     = cmd.Name;
     Activity = cmd.Activity;
     Url      = cmd.Url;
 }
Example #3
0
 public static EventEntity MakeEventEntity(UpdateCompanyCmd cmd)
 {
     return(new EventEntity {
         UserId = cmd.UserId,
         Body = new CompanyUpdatedEvt(cmd)
     });
 }
Example #4
0
        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)));
        }