Ejemplo n.º 1
0
        public async Task <ActionResult <PublicFooterTextForReturnDto> > Create(PublicFooterTextForCreationDto creationDto)
        {
            var footerText = await publicFooterTextService.Create(creationDto);

            if (footerText != null)
            {
                var onlineUser = await userTracker.GetOnlineUser();

                if (onlineUser != null && onlineUser.Length != 0)
                {
                    await hubContext.Clients.AllExcept(onlineUser).SendAsync("ReceiveFooterText", footerText);
                }
            }
            return(footerText);
        }
        public async Task <PublicFooterTextForReturnDto> Create(PublicFooterTextForCreationDto creationDto)
        {
            var getFooterText = await publicFooterTextDal.GetFooterTextAsync();

            if (getFooterText != null)
            {
                getFooterText.ContentPhoneNumber = creationDto.ContentPhoneNumber;
                getFooterText.FooterText         = creationDto.FooterText;
                await publicFooterTextDal.Update(getFooterText);
            }
            else if (getFooterText == null)
            {
                var mapForCreate = mapper.Map <PublicFooterText>(creationDto);
                getFooterText = await publicFooterTextDal.Add(mapForCreate);
            }
            return(mapper.Map <PublicFooterText, PublicFooterTextForReturnDto>(getFooterText));
        }