public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation($"{nameof(ToDoCommentAdd)} processed a request."); string toDoId = req.Query["toDoId"]; if (string.IsNullOrWhiteSpace(toDoId)) { throw new ArgumentNullException(nameof(toDoId)); } var toDoCommentAddOptions = await req.Body.DeserializeAsync <ToDoCommentAddOptions>(); var toDoCommentEntity = new ToDoCommentEntity { Body = toDoCommentAddOptions.Body, CreatedOn = DateTime.UtcNow }; await _toDoCommentEntityDataStore.AddAsync( toDoId, toDoCommentEntity); return(new CreatedResult("", new ToDoComment(toDoCommentEntity))); }
public ToDoComment( ToDoCommentEntity toDoCommentEntity) { this.Id = toDoCommentEntity.RowKey; this.ToDoId = toDoCommentEntity.PartitionKey; this.Body = toDoCommentEntity.Body; this.CreatedOn = toDoCommentEntity.CreatedOn; }
public ToDoComment( ToDoCommentEntity toDoCommentEntity) { this.Id = toDoCommentEntity.Id; this.ToDoId = toDoCommentEntity.ToDoId; this.Body = toDoCommentEntity.Body; this.CreatedOn = toDoCommentEntity.CreatedOn; }
public static ToDoCommentEntity GenerateToDoCommentEntity( this Faker faker, string toDoId) { var id = Guid.NewGuid().ToString(); var toDoCommentEntity = new ToDoCommentEntity { Id = id, ToDoId = toDoId, Body = faker.Lorem.Paragraph(1), CreatedOn = faker.Date.Recent() }; return(toDoCommentEntity); }