public ResponseDto Save(IncludeExcludeSaveDto saveDto) { ResponseDto responseDto = new ResponseDto(); IncludeExcludeSaveBo saveBo = new IncludeExcludeSaveBo() { ProductCategoryId = saveDto.ProductCategoryId, IsInclude = saveDto.IsInclude, IncludeExcludeName = saveDto.IncludeExcludeName, IncludeExcludeNameListStr = null, Session = Session }; ResponseBo responseBo = ieBusiness.Save(saveBo); responseDto = responseBo.ToResponseDto(); return(responseDto); }
/// <summary> /// This method is smilar to 'Save' in 'PropertyController.cs' /// </summary> /// <param name="saveDto"></param> /// <returns></returns> public ResponseDto SaveAll(IncludeExcludeSaveDto saveDto) { //if(Session.RealPerson.Id) ResponseDto responseDto = new ResponseDto(); IncludeExcludeSaveBo saveBo = new IncludeExcludeSaveBo() { ProductCategoryId = saveDto.ProductCategoryId, IsInclude = saveDto.IsInclude, IncludeExcludeName = saveDto.IncludeExcludeName, IncludeExcludeNameListStr = saveDto.IncludeExcludeNameListStr, Session = Session }; bool isValid = true; try { string[] listStr = null; if (saveBo.IncludeExcludeNameListStr.IsNull()) { isValid = false; } else { listStr = saveBo.IncludeExcludeNameListStr.Split('\n'); if (listStr.IsNull() || listStr.Length == 0) { isValid = false; } } List <string> nabersin = new List <string>(); if (isValid) { saveBo.IncludeExcludeNameListStr = ""; List <string> tlistStr = new List <string>(); foreach (var item in listStr) { if (item.IsNull() || item.Trim().IsNull()) { continue; } if (tlistStr.FirstOrDefault(f => string.Equals(f.ToLower(new CultureInfo("tr-Tr", false)), item.ToLower(new CultureInfo("tr-Tr", false)), StringComparison.CurrentCultureIgnoreCase)).IsNotNull()) { nabersin.Add(item); continue; } tlistStr.Add(item); saveBo.IncludeExcludeNameListStr += item + "\n"; } saveBo.IncludeExcludeNameListStr = saveBo.IncludeExcludeNameListStr.Substring(0, saveBo.IncludeExcludeNameListStr.Length - 1); } } catch (Exception ex) { isValid = false; } if (!isValid) { return(new ResponseDto() { Message = "Geçersiz format", IsSuccess = false }); } ResponseBo responseBo = ieBusiness.Save(saveBo); responseDto = responseBo.ToResponseDto(); return(responseDto); }