Exemple #1
0
        public async Task <StatusCodeResult> Put(ulong apartmentId, Models.SaveApartment saveApartment, CancellationToken cancellationToken)
        {
            var res = await this.mediator.Send(new UpdateApartment(apartmentId, Map(saveApartment, await this.GetRealtorId(saveApartment.RealtorId, cancellationToken))), cancellationToken);

            return(res.Match <StatusCodeResult>(success => this.Ok(), _ => this.NotFound()));
        }
Exemple #2
0
 private static Apartment Map(Models.SaveApartment apt, ulong realtorId)
 {
     return(new Apartment(0, apt.Name, apt.Description, apt.FloorArea, apt.PricePerMonth, apt.NumberOfRooms, apt.Lat, apt.Lon, DateTime.UtcNow, realtorId, apt.IsRented));
 }
Exemple #3
0
 public async Task <ulong> Post(Models.SaveApartment saveApartment, CancellationToken cancellationToken)
 {
     return(await this.mediator.Send(new AddApartment(Map(saveApartment, await this.GetRealtorId(saveApartment.RealtorId, cancellationToken))), cancellationToken));
 }