protected override bool IsValid(PropertyValidatorContext context) { // string email = context.PropertyValue as string; InputGuideCityDto m = context.Instance as InputGuideCityDto; return(_GuidecityService.IsNameUnique(m.ArabicCityName, null)); }
protected override bool IsValid(PropertyValidatorContext context) { // string email = context.PropertyValue as string; InputGuideCityDto m = context.Instance as InputGuideCityDto; return(_GuidecityService.IsExistId(m.Id)); }
public bool Edit(LanguageHelper Language, InputGuideCityDto dto) { GuideCity c = _unitOfWork.GuideCityRepository.FindById(dto.Id); c.GuideCityDescriptions = new List <GuideCityDescription>(); foreach (var Cdes in c.GuideCityDescriptions) { if (Cdes.LanguageId == (int)LanguageHelper.ARABIC) { Cdes.Name = dto.ArabicCityName; } else if (Cdes.LanguageId == (int)LanguageHelper.ENGLISH) { Cdes.Name = dto.EnglishCityName; } } _unitOfWork.GuideCityRepository.Update(c); _unitOfWork.SaveChanges(); return(true); }
public int Add(LanguageHelper Language, InputGuideCityDto dto) { var model = Mapper.Map <InputGuideCityDto, GuideCity>(dto); model.GuideCityDescriptions = new List <GuideCityDescription>(); GuideCityDescription ACdes = new GuideCityDescription(); ACdes.CityId = model.Id; ACdes.LanguageId = (int)LanguageHelper.ARABIC; ACdes.Name = dto.ArabicCityName; model.GuideCityDescriptions.Add(ACdes); GuideCityDescription ECdes = new GuideCityDescription(); ECdes.LanguageId = (int)LanguageHelper.ENGLISH; ECdes.Name = dto.EnglishCityName; model.GuideCityDescriptions.Add(ECdes); _unitOfWork.GuideCityRepository.Add(model); _unitOfWork.SaveChanges(); return(model.Id); }
public bool EditCity([FromBody] InputGuideCityDto dto) { return(_iGuideCityService.Edit(CurrentLanguage, dto)); }
// [ResponseCodes(HttpStatusCode.OK, HttpStatusCode.NotAcceptable, HttpStatusCode.Unauthorized)] public int AddCity([FromBody] InputGuideCityDto dto) { return(_iGuideCityService.Add(CurrentLanguage, dto)); }