Example #1
0
        public async Task<HttpResponseMessage> Post([FromBody]LandLordViewModel newLandlord)
        {
            var landlord = new LandLordViewModel()
            {
                Title = newLandlord.Title,
                FirstName = newLandlord.FirstName,
                LastName = newLandlord.LastName,
                Address = new AddressViewModel()
                {
                    HouseNameNumber = newLandlord.Address.HouseNameNumber,
                    StreetName = newLandlord.Address.StreetName,
                    Town = newLandlord.Address.Town,
                    County = newLandlord.Address.County,
                    Country = newLandlord.Address.Country,

                },
                PhoneNumbers = newLandlord.PhoneNumbers,
                Properties = newLandlord.Properties
            };

            await _landlordRepo.CreateAsync(landlord);
            return Request.CreateResponse(HttpStatusCode.Created, landlord);
        }
Example #2
0
 public Task CreateAsync(LandLordViewModel landLord)
 {
     landLord.Reference = generator.CreateReference(10);
     _landLords.Add(landLord);
     return Task.FromResult(landLord);
 }