public async Task <bool> Evalute(string projectId, Evalution evalution) { var EvaluatedProject = await _NoDb.FindAsync(projectId, projectId); EvaluatedProject.Evalution = evalution; var result = await _NoDb.UpdateAsync(EvaluatedProject); return(result.IsSuccess); }
public async Task <bool> UpdateProject(string projectId, CosmosProjectDto updatedProject) { var oldProject = await _NoDb.FindAsync(projectId, projectId); if (oldProject != null) { oldProject.ProjectName = updatedProject.ProjectName; var result = await _NoDb.UpdateAsync(oldProject); return(result.IsSuccess); } return(false); }
public async Task UpdateAsync(UserFlatForRentAnnouncementPreferenceUpdatedIntegrationEvent integrationEvent) { var flatForRentAnnouncementPreference = await _cosmosStore.FindAsync(integrationEvent.FlatForRentAnnouncementPreferenceId.ToString()); var sameCityDistricts = flatForRentAnnouncementPreference.CityDistricts.All(integrationEvent.CityDistricts.Contains) && flatForRentAnnouncementPreference.CityDistricts.Count == integrationEvent.CityDistricts.Count; if (flatForRentAnnouncementPreference.CityId != integrationEvent.CityId || flatForRentAnnouncementPreference.PriceMin != integrationEvent.PriceMin || flatForRentAnnouncementPreference.PriceMax != integrationEvent.PriceMax || flatForRentAnnouncementPreference.RoomNumbersMin != integrationEvent.RoomNumbersMin || flatForRentAnnouncementPreference.RoomNumbersMax != integrationEvent.RoomNumbersMax || !sameCityDistricts) { flatForRentAnnouncementPreference.AnnouncementUrlsToSend = new List <string>(); } flatForRentAnnouncementPreference.CityId = integrationEvent.CityId; flatForRentAnnouncementPreference.PriceMin = integrationEvent.PriceMin; flatForRentAnnouncementPreference.PriceMax = integrationEvent.PriceMax; flatForRentAnnouncementPreference.RoomNumbersMin = integrationEvent.RoomNumbersMin; flatForRentAnnouncementPreference.RoomNumbersMax = integrationEvent.RoomNumbersMax; flatForRentAnnouncementPreference.CityDistricts = integrationEvent.CityDistricts.ToList(); var updateResult = await _cosmosStore.UpdateAsync(flatForRentAnnouncementPreference); if (!updateResult.IsSuccess) { throw updateResult.Exception; } }
public async Task <bool> UpdatePostAsync(Post postToUpdate) { var response = await _cosmosStore.UpdateAsync(new CosmosPostDto { Id = postToUpdate.Id.ToString(), Name = postToUpdate.Name }); return(response.IsSuccess); }
public Task UpdateAsync(RoomForRentAnnouncement roomForRentAnnouncement) { var roomForRentAnnouncementEntity = _mapper.Map <RoomForRentAnnouncement, RoomForRentAnnouncementEntity>(roomForRentAnnouncement); return(_cosmosStore.UpdateAsync(roomForRentAnnouncementEntity)); }
public Task UpdateAsync(FlatForRentAnnouncement flatForRentAnnouncement) { var flatForRentAnnouncementEntity = _mapper.Map <FlatForRentAnnouncement, FlatForRentAnnouncementEntity>(flatForRentAnnouncement); return(_cosmosStore.UpdateAsync(flatForRentAnnouncementEntity)); }
public async Task UpdateAsync(UserRoomForRentAnnouncementPreferenceUpdatedIntegrationEvent integrationEvent) { var roomForRentAnnouncementPreference = await _cosmosStore.FindAsync(integrationEvent.RoomForRentAnnouncementPreferenceId.ToString()); var sameCityDistricts = roomForRentAnnouncementPreference.CityDistricts.All(integrationEvent.CityDistricts.Contains) && roomForRentAnnouncementPreference.CityDistricts.Count == integrationEvent.CityDistricts.Count; if (roomForRentAnnouncementPreference.CityId != integrationEvent.CityId || roomForRentAnnouncementPreference.PriceMin != integrationEvent.PriceMin || roomForRentAnnouncementPreference.PriceMax != integrationEvent.PriceMax || roomForRentAnnouncementPreference.RoomType != integrationEvent.RoomType || !sameCityDistricts) { roomForRentAnnouncementPreference.AnnouncementUrlsToSend = new List <string>(); } roomForRentAnnouncementPreference.CityId = integrationEvent.CityId; roomForRentAnnouncementPreference.PriceMin = integrationEvent.PriceMin; roomForRentAnnouncementPreference.PriceMax = integrationEvent.PriceMax; roomForRentAnnouncementPreference.RoomType = integrationEvent.RoomType; roomForRentAnnouncementPreference.CityDistricts = integrationEvent.CityDistricts.ToList(); var updateResult = await _cosmosStore.UpdateAsync(roomForRentAnnouncementPreference); if (!updateResult.IsSuccess) { throw updateResult.Exception; } }
public async Task <bool> UpdatePost(Post updatedPost) { var post = await cosmosStore.Query().FirstOrDefaultAsync(p => p.Id == updatedPost.Id.ToString()); post.Name = updatedPost.Name; var response = await cosmosStore.UpdateAsync(post); return(response.IsSuccess); }
public async Task ExecuteAsync(MarkProcessAsSuccessfulCommand command) { var process = await _cosmosStore.FindAsync(command.Id); process.EndDateTime = command.EndDateTime; process.Status = ProcessStatus.Succeeded; await _cosmosStore.UpdateAsync(process); }
public async Task <ReportTemplate> Put(string id, ReportTemplate reportTemplate, VerifiedUserContext verifiedUser) { var templateToPut = await _store.Query().FirstOrDefaultAsync(template => template.TemplateID == id); reportTemplate.id = templateToPut.id; var updatedTemplate = await _store.UpdateAsync(reportTemplate); return(updatedTemplate); }
public async Task <ReportTemplate> Put(string id, ReportTemplate reportTemplate, DecodedToken decodedToken) { var templateToPut = await _store.Query().FirstOrDefaultAsync(template => template.TemplateID == id); reportTemplate.id = templateToPut.id; var updatedTemplate = await _store.UpdateAsync(reportTemplate); return(updatedTemplate); }
public async Task <bool> UpdatePostAsync(Post updatedPost) { var cosmosPost = new CosmosPost { Id = updatedPost.Id.ToString(), Name = updatedPost.Name }; var response = await _CosmosStore.UpdateAsync(cosmosPost); return(response.IsSuccess); }
public async Task UpdateFamily(string id, string lastName) { var family = await GetSingleFamily(id); if (family != null) { family.LastName = lastName; await store.UpdateAsync(family); } }
public async Task <TodoItem> Update(TodoItem entity) { if (string.IsNullOrEmpty(entity.Title) && string.IsNullOrEmpty(entity.Description) && string.IsNullOrEmpty(entity.AssignedUserId)) { throw new BadRequestException(ErrorCode.ValidationErrorGeneric); } entity = await CompareObjectForUpdate(entity); entity.LastModified = DateTime.UtcNow; return(await store.UpdateAsync(entity)); }
public async Task <bool> UpdatePostAsync(Post postToUpdate) { var updatepost = new CosmosPostDto { Id = postToUpdate.ID.ToString(), Name = postToUpdate.Name }; var update = await _cosmosStore.UpdateAsync(updatepost); return(update.IsSuccess); }
public async Task <bool> UpdatePost(Post postToUpdate) { var cosmosPost = new CosmosPostDTO { Id = postToUpdate.Id.ToString(), Name = postToUpdate.Name }; var result = await _cosmosStore.UpdateAsync(cosmosPost); return(result.IsSuccess); }
public async Task <IActionResult> UpdateCrypto([FromForm] CryptoViewModel cryptoToUpdate) { if (cryptoToUpdate.valueUSD != null) { cryptoToUpdate.valueBTC = (double.Parse(cryptoToUpdate.valueUSD) / 7000).ToString(); cryptoToUpdate.valueETH = (double.Parse(cryptoToUpdate.valueUSD) / 283).ToString(); } var result = await _cosmosStore.UpdateAsync(cryptoToUpdate); return(RedirectToAction("Index")); }
public async Task <bool> UpdateMessageAsync(Message message) { var messageCosmos = new MessageCosmos { Id = message.Id.ToString(), Text = message.Text }; var response = await _cosmosStore.UpdateAsync(messageCosmos); return(response.IsSuccess); }
public async Task <bool> UpdateOrderAsync(Order orderToUpdate) { var cosmosOrder = new CosmosOrderDto { Id = orderToUpdate.Id.ToString(), Amount = orderToUpdate.Amount }; var response = await _cosmosStore.UpdateAsync(cosmosOrder); return(response.IsSuccess); }
public async Task <bool> UpdateAsync(Post post) { var cosmosPostDto = new CosmosPostDto { Id = post.Id.ToString(), Name = post.Name }; var updated = await _cosmosStore.UpdateAsync(cosmosPostDto); return(updated.IsSuccess); }
public async Task <bool> UpdateCustomTaskAsync(CustomTask customTaskToUpdate) { var cosmosCustomTask = new CosmosCustomTaskDto { Title = customTaskToUpdate.Title, Description = customTaskToUpdate.Description }; var response = await _cosmosStore.UpdateAsync(cosmosCustomTask); return(response.IsSuccess); }
public async Task <bool> UpdateArtist(Artist artist, string partitionKey) { var art = GetArtist(partitionKey); if (artist != null) { artist.PartitionKey = partitionKey; await Store.UpdateAsync(artist); return(true); } return(false); }
public async Task <bool> UpdateProductAsync(Product product) { var productCosmos = new CosmosProduct { ProductID = product.ProductID.ToString(), ProductName = product.ProductName, ProductCode = product.ProductCode }; var response = await _cosmosStore.UpdateAsync(productCosmos); return(response.IsSuccess); }
public async Task ExecuteAsync(MarkProcessAsFailedCommand command) { var process = await _cosmosStore.FindAsync(command.Id); process.EndDateTime = command.EndDateTime; process.Status = ProcessStatus.Failed; process.FailureDetails = new FailureDetails() { ErrorNumber = command.ErrorNumber, ErrorMessage = command.ErrorMessage }; await _cosmosStore.UpdateAsync(process); }
public async Task <User> Update(User entity) { if (string.IsNullOrEmpty(entity.Password)) { var current = await Fetch(entity.Id); entity.Password = current.Password; } CosmosResponse <User> response = await store.UpdateAsync(entity); if (!response.IsSuccess && response.CosmosOperationStatus == CosmosOperationStatus.ResourceNotFound) { throw new NotFoundException(ErrorCode.NotFoundErrorGeneric, "Resource not found"); } return(response); }
public async Task <T> Put(T update) { var time = DateTime.Now; update.DateLastUpdated = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0); var resourceToUpdate = (await List(update.ResourceID)).FirstOrDefault(record => record.ResourceID == update.ResourceID && record.DateLastUpdated == update.DateLastUpdated); try { update.id = resourceToUpdate.id; update.Action = resourceToUpdate.Action; return(await _productStore.UpdateAsync(update)); } catch { return(await _productStore.AddAsync(update)); } }
public async Task <bool> UpdatePostAsync(Post postToUpdate) { var post = await cosmosStore.FindAsync(postToUpdate.Id.ToString()); if (post == null) { return(false); } var cosmposPost = new CosmosPostDto() { Id = postToUpdate.Id.ToString(), Name = postToUpdate.Name }; var response = await cosmosStore.UpdateAsync(cosmposPost); return(response.IsSuccess); }
public async Task <string> Handle(UpdateEbatchSheetCommand request, CancellationToken cancellationToken) { _logger.LogInformation(nameof(UpdateEbatchSheetCommandHandler) + "UPDATE_EBATCHSHEET: {requestId} - {@BODY} ", request.Id, request); var ebatchSheet = await _cosmosStore.FindAsync(request.Id, Constants.EBATCH_SHEET_PARTITON_KEY); var user = _httpContext.HttpContext?.User; if (ebatchSheet != null) { var currentState = ebatchSheet.CurrentState; var requestedState = request.CurrentState; ebatchSheet.UpdateDataWithoutChangingState(request); if (!requestedState.Equals(currentState)) { if (user.IsInRole(UserRole.AdminTeam)) { ebatchSheet.ChangeState(requestedState); } else { ebatchSheet.ProceedNextState(requestedState); } } var result = await _cosmosStore.UpdateAsync(ebatchSheet); if (!currentState.Equals(result.Entity.CurrentState)) { await _ebatchSheetEmailSender.SendEmail(ebatchSheet); } return(request.Id); } else { var exception = new NotFoundException($"EBATCHSHEET", request.Id); _logger.LogError(exception, $"[UpdateEbatchSheetCommandHandler] Ebatchsheet {request.Id} not found"); throw exception; } }
public async Task <IActionResult> Update( Guid id, [FromBody] EditIndexRequest request, CancellationToken cancellationToken) { if (id == Guid.Empty) { return(BadRequest("Invalid index Id")); } if (request.Name.Trim().Length == 0) { return(BadRequest("Index Name can not be empty")); } var existingIndex = await _indexCosmosStore.FindAsync(id.ToString()); if (existingIndex == null) { return(NotFound()); } var indexToSave = new Index { Id = id.ToString(), Name = request.Name, Location = request.Location, Enabled = request.Enabled }; var result = await _indexCosmosStore.UpdateAsync(indexToSave); var indexId = result.Entity.Id; if (indexId == null) { return(BadRequest()); } return(Ok(indexId)); }
public async Task <IActionResult> Update(Guid id, [FromBody] EditPersonRequest request, CancellationToken cancellationToken) { if (id == Guid.Empty) { return(BadRequest("Invalid Person Id")); } if (request.Name.Trim().Length == 0) { return(BadRequest("Person Name can not be empty")); } var existingPerson = await _peopleCosmosStore.FindAsync(id.ToString(), cancellationToken : cancellationToken); if (existingPerson == null) { return(NotFound()); } var personToSave = new Person { Id = id.ToString(), Name = request.Name }; var result = await _peopleCosmosStore.UpdateAsync(personToSave, cancellationToken : cancellationToken); var personId = result.Entity.Id; if (personId == null) { return(BadRequest()); } return(Ok(personId)); }