public async Task <bool> Update(UpdateUserCmd cmd) { var evt = UserUpdatedEvt.MakeEventEntity(cmd); var insertions = await eventRepository.Create(evt); return(insertions > 0); }
public static Domain.User.User ToUser(this UpdateUserCmd res) => new Domain.User.User { Id = res.Id, Nickname = res.Nickname, FirstName = res.FirstName, LastName = res.LastName, IDDocument = res.Document, Password = res.Password, Email = res.Email, State = res.State, RoleId = res.RoleId, EntityId = res.EntityId };
public async Task <IActionResult> Update(long id, [FromBody] UpdateUserReq req) { var cmd = new UpdateUserCmd(req, id, HttpContext.UserId().Value); var updated = await userRepository.Update(cmd); var user = await userRepository.WithId(id); if (updated) { return(Ok(user)); } else { return(BadRequest()); } }
public IActionResult Put( [ModelBinder( BinderType = typeof(JsonModelBinder))] UpdateUserCmd value, IList <IFormFile> files, Boolean fileWasChange, Boolean restorePass ) { Stream stream = null; if (files != null && files.Length() > 0) { IFormFile file = files[0]; stream = file.OpenReadStream(); } return(updateCommand.Execute(value, stream, fileWasChange, restorePass).Match( Succ: x => x.Match <IActionResult>(Ok, BadRequest), Fail: ex => StatusCode(500, ex))); }