/// <summary> /// Método responsável por orquestrar as funções de inserção de uma nova reserva /// </summary> /// <param name="socialNumber">Número do cpf</param> /// <param name="roomId">Número do quarto</param> /// <param name="days">Dias de hospedagem</param> /// <returns></returns> public BookingEntity Insert(string socialNumber, int roomId, int days) { var bookingEntity = new BookingEntity { Client = _clientBusiness.GetBySocialNumber(socialNumber), Room = _roomBusiness.GetById(roomId), Days = days }; if (bookingEntity.Client.Validations.Any() || bookingEntity.Room.Validations.Any()) { return(bookingEntity); } var booking = _bookingBusiness.Insert(bookingEntity); return(booking); }
/// <summary> /// Obtem cliente através do númeor de cpf /// </summary> /// <param name="socialNumber"></param> /// <returns></returns> public ClientEntity GetBySocialNumber(string socialNumber) { var client = _clientBusiness.GetBySocialNumber(socialNumber); return(client); }
public ClientResponseViewModel GetBySocialNumber(string socialNumber) { return(_mapper.Map <ClientResponseViewModel>(_clientBusiness.GetBySocialNumber(socialNumber))); }