public string Resolve(RequestDetail source, RequestDetailModel destination, string destMember, ResolutionContext context) { if (source.FormField.FiledType == EFCore.Enum.FieldType.Dropdown || source.FormField.FiledType == EFCore.Enum.FieldType.CheckBox || source.FormField.FiledType == EFCore.Enum.FieldType.RadioButton) { var value = _fieldOptionService.Get(Convert.ToInt32(source.Value)); return(value == null ? "" : value.NameAr); } return(source.Value); }
public BidModel Get(int id) { var Bid = GetQuery().Include("BidDetails").Include("BidDetails.FormField").FirstOrDefault(x => x.Id == id); if (Bid == null) { throw new NotFoundException("Bid is not found"); } var model = _mapper.Map <BidModel>(Bid); foreach (var item in model.BidDetails) { if (item.FieldTypeId == (int)EFCore.Enum.FieldType.Dropdown || item.FieldTypeId == (int)EFCore.Enum.FieldType.CheckBox || item.FieldTypeId == (int)EFCore.Enum.FieldType.RadioButton) { var option = _fieldOptionService.Get(Convert.ToInt32(item.Value)); item.ValueText = option == null ? "" : option.NameAr; } } return(model); }
public RequestModel Get(int id) { var Request = GetQuery().Include("RequestDetails").Include("RequestDetails.FormField").Include("Form").FirstOrDefault(x => x.Id == id); if (Request == null) { throw new NotFoundException("Request is not found"); } var model = _mapper.Map <RequestModel>(Request); foreach (var item in model.RequestDetails) { if (item.FieldTypeId == (int)EFCore.Enum.FieldType.Dropdown || item.FieldTypeId == (int)EFCore.Enum.FieldType.CheckBox || item.FieldTypeId == (int)EFCore.Enum.FieldType.RadioButton) { var option = _fieldOptionService.Get(Convert.ToInt32(string.IsNullOrEmpty(item.Value) ? "0" : item.Value)); item.ValueText = option == null ? "" : option.NameAr; } } return(model); }