Esempio n. 1
0
        public ActionResult Create(CityViewModel cityModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var entityResult = _placesService.AddCity(cityModel);

                    if (entityResult.Succeeded)
                    {
                        AddMessageToTempData(CommonResources.SavedSuccessfullyMessage, BusinessSolutions.MVCCommon.MessageType.Success);
                        return(RedirectToAction("Index"));
                    }

                    AddValidationErrors(entityResult);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                AddMessageToView(CommonResources.UnExpectedError, BusinessSolutions.MVCCommon.MessageType.Error);
            }

            return(View(cityModel));
        }
Esempio n. 2
0
        public void AddCity()
        {
            PlaceServiceTestCases.City =
                new CityViewModel {
                RegionId = PlaceServiceTestCases.Region.RegionId, CityName = "ParentCity"
            };

            var result = _placesServices.AddCity(PlaceServiceTestCases.City);

            for (int i = 0; i < 5; i++)
            {
                _placesServices.AddCity(new CityViewModel
                {
                    CityCode   = "Code" + i,
                    CityName   = "المدينة" + i,
                    CityNameEn = "CityName" + i,
                    RegionId   = PlaceServiceTestCases.Region.RegionId,
                });
            }
        }