Beispiel #1
0
        public void TransformISODate_Returns_MonthName()
        {
            var request = new BookTimeRequest()
            {
                Date = "2018-09-09"
            };

            Assert.Equal("Сентябрь", request.GetMonthName());
        }
        // TODO : Test it and change the logic of creating json serialized object through the dynamic as above
        public async Task BookTime(BookTimeRequest req)
        {
            var builder = new StringBuilder();

            foreach (var slot in req.Timeslots)
            {
                builder.Append($"\"{slot.Time}\": \"{slot.Available}\"");
                builder.Append(",");
            }
            builder.Remove(builder.Length - 1, 1);

            //var toPatch = "{ "+ builder.ToString().TrimEnd(',') + " }";
            var toPatch = "{ " + builder + " }";

            await _firebase.Child("schedule")
            .Child(req.GetMonthName())
            .Child(req.Id)
            .Child("Days")
            .Child(req.Date)
            .PatchAsync(toPatch);

            //.PatchAsync($"{{ {segment}, \"16:00\": \"False\", \"15:00\": \"False\" }}");
        }
 public async Task Patch(BookTimeRequest req)
 {
     await _firebaseDataService.BookTime(req);
 }