public async Task <RoomTypeResponseModel> CreateRoomType(RoomTypeRequestModel roomTypeRequestModel) { var roomType = _mapper.Map <RoomType>(roomTypeRequestModel); var createdRoomType = await _roomTypeRepository.AddAsync(roomType); return(_mapper.Map <RoomTypeResponseModel>(createdRoomType)); }
public async Task AddNewAsyncTest() { var roomtype = new RoomType { RoomTypeName = "Demo Room Type" }; roomtype.Created(Guid.NewGuid()); await _repository.AddAsync(roomtype); Assert.True(_context.SaveChangesAsync().Result); }
public async Task <ActionResult> Create(RoomType RoomType) { RoomType.Id = System.Guid.NewGuid().ToString(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await _repository.AddAsync(RoomType); return(RedirectToAction(nameof(Index))); } catch { return(View(RoomType)); } }
public async Task <bool> AddRoomTypeAsync(RoomTypeViewModel newRoomType) { RoomType model = _mapper.Map <RoomType>(newRoomType); return(await _roomTypeRepository.AddAsync(model)); }
public async Task <RoomType> AddRoomType(RoomType roomType) { return(await _roomTypeRepository.AddAsync(roomType)); }