public AttendeeDTO(Attendee attendee) { ReadAttendeeBase(attendee); DisplayName = attendee.DisplayName; FirstName = attendee.FirstName; LastName = attendee.LastName; Email = attendee.Email; Username = attendee.Username; PhotoFilename = attendee.PhotoFilename; PhotoFolder = attendee.PhotoFolder; PhotoWidth = attendee.PhotoWidth; PhotoHeight = attendee.PhotoHeight; PhotoContentType = attendee.PhotoContentType; Biography = attendee.Biography; Company = attendee.Company; CreatedByUser = attendee.CreatedByUser; LastModifiedByUser = attendee.LastModifiedByUser; ProfilePic = new ImageDTO(); if (attendee.PhotoFilename != null) { ProfilePic.filename = attendee.PhotoFilename; ProfilePic.width = (int)attendee.PhotoWidth; ProfilePic.height = (int)attendee.PhotoHeight; } }
public SpeakerDTO(Speaker speaker) { ReadSpeakerBase(speaker); DisplayName = speaker.DisplayName; FirstName = speaker.FirstName; LastName = speaker.LastName; Email = speaker.Email; Username = speaker.Username; PhotoFilename = speaker.PhotoFilename; PhotoFolder = speaker.PhotoFolder; PhotoWidth = speaker.PhotoWidth; PhotoHeight = speaker.PhotoHeight; PhotoContentType = speaker.PhotoContentType; Biography = speaker.Biography; Company = speaker.Company; CreatedByUser = speaker.CreatedByUser; LastModifiedByUser = speaker.LastModifiedByUser; ProfilePic = new ImageDTO(); if (speaker.PhotoFilename != null) { ProfilePic.filename = speaker.PhotoFilename; ProfilePic.width = (int)speaker.PhotoWidth; ProfilePic.height = (int)speaker.PhotoHeight; } }
/// <summary> /// /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id"></param> /// <param name="body"> (optional)</param> /// <returns>Task of ProductDTO</returns> public async System.Threading.Tasks.Task <ProductDTO> ApiCategoriesIdImagePutAsync(int?id, ImageDTO body = null) { ApiResponse <ProductDTO> localVarResponse = await ApiCategoriesIdImagePutAsyncWithHttpInfo(id, body); return(localVarResponse.Data); }
/// <summary> /// /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id"></param> /// <param name="body"> (optional)</param> /// <returns>Task of ApiResponse (ProductDTO)</returns> public async System.Threading.Tasks.Task <ApiResponse <ProductDTO> > ApiCategoriesIdImagePutAsyncWithHttpInfo(int?id, ImageDTO body = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling CategoriesApi->ApiCategoriesIdImagePut"); } var localVarPath = "/api/Categories/{id}/image"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json", "application/_*+json" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (id != null) { localVarPathParams.Add("id", this.Configuration.ApiClient.ParameterToString(id)); // path parameter } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("ApiCategoriesIdImagePut", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <ProductDTO>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (ProductDTO)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ProductDTO)))); }
public Response <ImageDTO> Update(ImageDTO element) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id"></param> /// <param name="body"> (optional)</param> /// <returns>ProductDTO</returns> public ProductDTO ApiCategoriesIdImagePut(int?id, ImageDTO body = null) { ApiResponse <ProductDTO> localVarResponse = ApiCategoriesIdImagePutWithHttpInfo(id, body); return(localVarResponse.Data); }
public static UserDataModel ToDataModel(UserDTO userDTO, UserAccountDTO accountDTO, AddressDTO addressDTO, PhoneDTO phoneDTO, EmailDTO emailDTO, List <ExperienceDTO> userExpriencelDTO, List <AchievementDTO> userAchievementlDTO, List <EducationDTO> userEducationlDTO, List <SkillDTO> userSkillDTO, List <LanguageDTO> userLanguageDTO, ImageDTO imageDTO) { UserDataModel model = null; if (userDTO != null) { model = new UserDataModel { UserID = userDTO.UserID, UserName = userDTO.UserName, FirstName = userDTO.FirstName, MiddleName = userDTO.MiddleName, LastName = userDTO.LastName, DOB = userDTO.DOB, IsActive = userDTO.IsActive, IsDeleted = userDTO.IsDeleted, insuser = userDTO.insuser, insdt = userDTO.insdt, upduser = userDTO.upduser, upddt = userDTO.upddt, Description = userDTO.Description }; if (accountDTO != null) { model.UserAccountID = accountDTO.UserAccountID; model.UserAccountinsdt = accountDTO.insdt; model.UserAccountinsuser = accountDTO.insuser; model.UserAccountIsActive = accountDTO.IsActive; model.UserAccountIsDeleted = accountDTO.IsDeleted; model.UserAccountPassword = Encoding.ASCII.GetString(accountDTO.Password); model.UserAccountupddt = accountDTO.upddt; model.UserAccountupduser = accountDTO.upduser; model.UserAccountUserName = accountDTO.UserName; } if (addressDTO != null) { model.UserAddressAddressTypeID = addressDTO.AddressTypeID; model.UserAddressCity = addressDTO.City; model.UserAddressCountryID = addressDTO.CountryID; model.UserAddressID = addressDTO.AddressID; model.UserAddressLine1 = addressDTO.Line1; model.UserAddressLine2 = addressDTO.Line2; model.UserAddressLine3 = addressDTO.Line3; model.UserAddressState = addressDTO.State; model.UserAddressTitle = addressDTO.Title; model.UserAddressZipCode = addressDTO.ZipCode; } if (phoneDTO != null) { model.UserPhoneCountryID = phoneDTO.CountryID; model.UserPhoneAddressBookID = phoneDTO.AddressbookID; model.UserPhoneExt = phoneDTO.Ext; model.UserPhoneID = phoneDTO.PhoneID; model.UserPhoneNumber = phoneDTO.Number; model.UserPhoneTypeID = phoneDTO.PhoneTypeID; } if (emailDTO != null) { model.UserEmailAddress = emailDTO.Address; model.UserEmailID = emailDTO.EmailID; model.UserEmailTypeID = emailDTO.EmailTypeID; } if (userExpriencelDTO != null) { List <ExperienceDTO> lst = new List <ExperienceDTO>(); foreach (var item in userExpriencelDTO) { lst.Add(new ExperienceDTO() { Business = item.Business, JobPossition = item.JobPossition, StartDate = item.StartDate, EndDate = item.EndDate, ExperienceID = item.ExperienceID, BusinessID = item.BusinessID, IsCurrent = item.IsCurrent }); } model.ExprienceModal = lst; } if (userAchievementlDTO != null) { List <AchievementDTO> lst = new List <AchievementDTO>(); foreach (var item in userAchievementlDTO) { lst.Add(item); } model.AchievementModel = lst; } if (userEducationlDTO != null) { List <EducationDTO> lst = new List <EducationDTO>(); foreach (var item in userEducationlDTO) { lst.Add(item); } model.EducationModel = lst; } if (userSkillDTO != null) { List <SkillDTO> lst = new List <SkillDTO>(); foreach (var item in userSkillDTO) { lst.Add(item); } model.SkillModel = lst; } if (userLanguageDTO != null) { List <LanguageDTO> lst = new List <LanguageDTO>(); foreach (var item in userLanguageDTO) { lst.Add(item); } model.LanguageModel = lst; } if (imageDTO != null) { model.UserImageExt = imageDTO.ImageExtension; model.UserImageName = imageDTO.Name; } } return(model); }
public async Task AddImageAsync(string id, [FromBody] ImageDTO item) { await _restaurantService.AddImageAsync(item, id); }
public void Create(ImageDTO item) { Database.Images.Create(Mapper.Map <ImageDTO, Image>(item)); Database.Save(); }
public async Task <IActionResult> PutImage([FromRoute] int id, [FromBody] ImageDTO data) { if (id <= 0) { return(BadRequest()); } var user = await _userManager.GetUserAsync(User); if (user == null) { return(Unauthorized()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (data.Base64.Length == 0) { return(BadRequest()); } Article article = await _context.Articles.FirstOrDefaultAsync(elem => elem.Id == id); if (article == null) { return(NotFound()); } byte[] imageData; try { imageData = Convert.FromBase64String(data.Base64); } catch (Exception ex) { return(BadRequest(ex)); } ArticleImage image = new ArticleImage() { Name = data.Name, Image = imageData }; article.Images.Add(image); _context.Entry(article).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch { throw; } ImageDTO responseData = new ImageDTO() { Id = image.Id, Name = image.Name, Base64 = Convert.ToBase64String(image.Image) }; return(Ok(responseData)); }
// GET api/imageV2 public string Post([FromBody] ImageDTO imageDTO) { //return mapHref; return(BdzWebsiteUtilities.BDZWebsiteUtilities.ParseMap(imageDTO.mapHref)); }
public static BusinessDataModel ToDataModel(BusinessDTO BusinessDTO, List <AddressDTO> primaryAddressDTO, PhoneDTO primaryPhoneDTO, EmailDTO primaryEmailDTO, ImageDTO ImageDTO, List <AchievementDTO> primaryAchievementDTO , BusinessUserMapDTO businessUserMapDTO, List <ServiceDTO> primaryServiceDTO) { BusinessDataModel model = new BusinessDataModel(); if (model != null) { model.Abbreviation = BusinessDTO.Abbreviation; model.BusinessID = BusinessDTO.BusinessID; model.BusinessTypeID = BusinessDTO.BusinessTypeID; model.insdt = BusinessDTO.insdt; model.insuser = BusinessDTO.insuser; model.IsActive = BusinessDTO.IsActive; model.IsDeleted = BusinessDTO.IsDeleted; model.Name = BusinessDTO.Name; model.StartDate = BusinessDTO.StartDate; model.upddt = BusinessDTO.upddt; model.upduser = BusinessDTO.upduser; model.Description = BusinessDTO.Description; } if (businessUserMapDTO != null) { model.BusinessUserId = businessUserMapDTO.BusinessUserMapID; model.BusinessUserMapTypeCodeId = businessUserMapDTO.BusinessUserTypeID ?? 0; } model.Addresses = new List <AddressDTO>(); if (primaryAddressDTO != null) { foreach (var item in primaryAddressDTO) { if (item != null) { AddressDTO addressDTO = new AddressDTO(); addressDTO.AddressID = item.AddressID; addressDTO.AddressTypeID = item.AddressTypeID; addressDTO.City = item.City; addressDTO.CountryID = item.CountryID; addressDTO.AddressID = item.AddressID; addressDTO.Line1 = item.Line1; addressDTO.Line2 = item.Line2; addressDTO.Line3 = item.Line3; addressDTO.State = item.State; addressDTO.Title = item.Title; addressDTO.ZipCode = item.ZipCode; model.Addresses.Add(addressDTO); } } } model.Achievement = new List <AchievementDTO>(); if (primaryAchievementDTO != null) { foreach (var item in primaryAchievementDTO) { if (item != null) { AchievementDTO achievementDTO = new AchievementDTO(); achievementDTO.AchievementID = item.AchievementID; achievementDTO.Date = item.Date; achievementDTO.Name = item.Name; model.Achievement.Add(achievementDTO); } } } model.Service = new List <ServiceDTO>(); if (primaryServiceDTO != null) { foreach (var item in primaryServiceDTO) { if (item != null) { ServiceDTO serviceDTO = new ServiceDTO(); serviceDTO.ServiceID = item.ServiceID; serviceDTO.BusinessID = item.BusinessID; serviceDTO.Name = item.Name; model.Service.Add(serviceDTO); } } } if (primaryPhoneDTO != null) { model.BusinessPhoneCountryID = primaryPhoneDTO.CountryID; model.BusinessPhoneExt = primaryPhoneDTO.Ext; model.BusinessPhoneID = primaryPhoneDTO.PhoneID; model.BusinessPhoneNumber = primaryPhoneDTO.Number; model.BusinessPhoneTypeID = primaryPhoneDTO.PhoneTypeID; model.BusinessPhoneAddressbookID = primaryPhoneDTO.AddressbookID; } if (primaryEmailDTO != null) { model.BusinessEmailAddress = primaryEmailDTO.Address; model.BusinessEmailID = primaryEmailDTO.EmailID; model.BusinessEmailTypeID = primaryEmailDTO.EmailTypeID; } if (ImageDTO != null) { model.BusinessImageID = ImageDTO.ImageID; model.ImageExtension = ImageDTO.ImageExtension; model.ImageName = ImageDTO.Name; } return(model); }
public async Task Delete(ImageDTO imageDTO) { Image image = _mapper.Map <Image>(imageDTO); await _imageService.DeleteImageAsync(image); }
/// <summary> /// Invoked when <see cref="ToEntity"/> operation is about to return. /// </summary> /// <param name="entity"><see cref="Image"/> converted from <see cref="ImageDTO"/>.</param> static partial void OnEntity(this ImageDTO dto, Image entity);
/// <summary> /// Invoked when <see cref="ToDTO"/> operation is about to return. /// </summary> /// <param name="dto"><see cref="ImageDTO"/> converted from <see cref="Image"/>.</param> static partial void OnDTO(this Image entity, ImageDTO dto);