public async Task <PublicLogoForReturnDto> SetMain(PublicLogoForCreationDto creationDto) { var logo = await publicLogoService.SetMain(creationDto); if (logo != null) { await hubContext.Clients.All.SendAsync("ReceiveLogo", logo); } return(logo); }
public async Task <PublicLogoForReturnDto> Create(FileUploadDto uploadDto) { var uploadFile = await upload.Upload(uploadDto.File, "publiclogo"); var mapForCreate = new PublicLogoForCreationDto(); mapForCreate.Name = uploadFile.Name; mapForCreate.FullPath = uploadFile.FullPath; mapForCreate.FileType = uploadFile.FileType; mapForCreate.IsMain = false; var mapForDb = mapper.Map <PublicLogo>(mapForCreate); var createPhoto = await publicLogoDal.Add(mapForDb); return(mapper.Map <PublicLogo, PublicLogoForReturnDto>(createPhoto)); }
public async Task <PublicLogoForReturnDto> Update(PublicLogoForCreationDto updateDto) { var checkByIdFromRepo = await publicLogoDal.GetAsync(x => x.Id == updateDto.Id); if (checkByIdFromRepo == null) { throw new RestException(HttpStatusCode.BadRequest, new { NotFound = Messages.NotFound }); } var mapForUpdate = mapper.Map(updateDto, checkByIdFromRepo); if (mapForUpdate.IsMain) { mapForUpdate.IsMain = false; } var updatePhoto = await publicLogoDal.Update(mapForUpdate); return(mapper.Map <PublicLogo, PublicLogoForReturnDto>(updatePhoto)); }
public async Task <PublicLogoForReturnDto> Update(PublicLogoForCreationDto creationDto) { return(await publicLogoService.Update(creationDto)); }