internal static BL.Model.Place ToPlace(DL.Place place) { BL.Model.Place pl = new BL.Model.Place() { Id = place.Id, Name = place.Name, Address = place.Address, Contact = place.Contact, LogoUrl = place.LogoUrl, ViewUrl = place.ViewUrl, }; return(pl); }
public async Task CreateAsync(string userId, BL.Model.Place place) { if (place == null) { throw new ArgumentNullException(nameof(place)); } DL.Place pl = _mapper.Map <DL.Place>(place); var user = new AspNetUsers() { Id = userId }; pl.AspNetUsers.Add(user); _dbContext.AspNetUsers.Attach(user); _dbContext.Place.Add(pl); await _dbContext.SaveChangesAsync(); }