Esempio n. 1
0
        /// <summary>
        /// Maps view model of hotelmealtype to hotelmealtype model
        /// </summary>
        /// <param name="hotelMealTypeToMap"></param>
        /// <param name="hotelMealTypeDatabase"></param>
        /// <param name="userName"></param>
        /// <returns>Message</returns>
        public static HotelMealType AutoMapperHotelMealType(HotelMealType hotelMealTypeToMap, HotelMealType hotelMealTypeDatabase, string userName)
        {
            var hotelMealTypeMapped = AutoMapper.Mapper.Map <HotelMealType>(hotelMealTypeToMap);

            ResolveRemainingParamtersOfHotelMealType(hotelMealTypeMapped, hotelMealTypeDatabase, userName);
            return(hotelMealTypeMapped);
        }
Esempio n. 2
0
        public async Task TestGetHotelMealType_positive_Predicate_sample()
        {
            //Arrange
            int hotelId       = 5;
            var hotelMealType = new HotelMealType()
            {
                Id = 1, HotelId = 5, MealId = 1, CuisineTypeId = 1, Name = "Breakfast", Code = "BFC"
            };
            var baseResult = new BaseResult <List <HotelMealType> >()
            {
                Result = new List <HotelMealType>()
                {
                    hotelMealType
                }
            };
            var pred = new Func <HotelMealType, bool>(x => x.IsActive && !x.IsDeleted);

            iHotelMealTypeConnectionLibrary.Setup(x => x.GetListByPredicate(It.Is <Func <HotelMealType, bool> >(y => y.GetType() == pred.GetType()))).Returns(Task.FromResult(baseResult));
            //Act
            Task <BaseResult <List <HotelMealType> > > result = mealPlanRepository.GetHotelMealType(hotelId);

            //Assert
            Assert.IsTrue(result.Result != null);
            Assert.IsTrue(result.Result is BaseResult <List <HotelMealType> >);
        }
Esempio n. 3
0
        /// <summary>
        ///  Return the mapped HotelMeal and HotelMealType model
        /// </summary>
        /// <param name="hotelAssociateMealPlanViewModel"></param>
        /// <returns></returns>
        public static void MapHotelMealAndHotelMealType(ref HotelMeal hotelMeal, ref List <HotelMealType> hotelMealTypeList, MealPlanViewModel mealPlanViewModel, string userName)
        {
            hotelMeal            = new HotelMeal();
            hotelMeal.HotelId    = mealPlanViewModel.HotelId;
            hotelMeal.MealId     = mealPlanViewModel.MealId;
            hotelMeal.Code       = "Meal_" + hotelMeal.HotelId + "_" + hotelMeal.MealId;
            hotelMeal.Price      = mealPlanViewModel.MealPlanOptions.Price;
            hotelMeal.CurrencyId = (mealPlanViewModel.MealPlanOptions.CurrencyId == null)? 0: mealPlanViewModel.MealPlanOptions.CurrencyId.Value;
            hotelMeal.CreatedBy  = userName;
            hotelMeal.UpdatedBy  = userName;
            if (mealPlanViewModel.IsSelected)
            {
                hotelMeal.IsDeleted = false;
            }
            else
            {
                hotelMeal.IsDeleted = true;
            }
            hotelMealTypeList = new List <HotelMealType>();
            foreach (var cuisine in mealPlanViewModel.MealPlanOptions.CuisineOptions)
            {
                HotelMealType model = new HotelMealType();
                model.HotelId       = mealPlanViewModel.HotelId;
                model.MealId        = mealPlanViewModel.MealId;
                model.CuisineTypeId = cuisine.Id;
                model.Code          = "MealType_" + hotelMeal.HotelId + "_" + hotelMeal.MealId + "_" + model.CuisineTypeId;
                model.Name          = cuisine.Cusine;
                model.NameItemId    = 1;
                model.CreatedBy     = userName;
                model.UpdatedBy     = userName;
                model.IsActive      = true;

                if (cuisine.IsSelected)
                {
                    model.IsDeleted = false;
                }
                else
                {
                    model.IsDeleted = true;
                }
                hotelMealTypeList.Add(model);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Resolve remaining parameters
 /// </summary>
 /// <param name="destination"></param>
 /// <param name="source"></param>
 public static void ResolveRemainingParamtersOfHotelMealType(HotelMealType destination, HotelMealType source, string userName)
 {
     destination.Id        = source.Id;
     destination.CreatedBy = source.CreatedBy;
     destination.UpdatedBy = userName;
 }