Exemple #1
0
        public async Task <ActionResult> Update(NotifyDTO notify)
        {
            var result = await this.Mediator.Send(new UpdateNotifyCommand
            {
                Data = notify
            });

            return(ResponseHelper.ResponseOutcome <NotifyDTO>(result, this));
        }
Exemple #2
0
        public async Task <ActionResult> Search(NotifyDTO searchModel)
        {
            var result = await this.Mediator.Send(new GetNotifiesQuery
            {
                SearchModel = searchModel ?? new NotifyDTO()
            });

            return(ResponseHelper.ResponseOutcome <NotifyDTO>(result, this));
        }
Exemple #3
0
        public static Notify Map(this NotifyDTO dto) =>
        (dto != null) ? new Notify
        {
            Id         = dto.Id,
            CustomerId = dto.CustomerId ?? dto.CustomerId.Value,
            DateSent   = dto.DateSent ?? dto.DateSent.Value,
            Email      = dto.Email,
            Retry      = dto.Retry ?? dto.Retry.Value,
            Sent       = dto.Sent ?? dto.Sent.Value
        }

             : null;
        public async Task <String> Post([FromBody] NotifyDTO notifyDTO)
        {
            try
            {
                var result = await fireBaseService.SendNotification(notifyDTO);

                return(result);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public static NotifyEN Convert(NotifyDTO dto)
        {
            NotifyEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new NotifyEN();



                    if (dto.Users_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IUserCAD userCAD = new MoSIoTGenNHibernate.CAD.MosIoT.UserCAD();

                        newinstance.Users = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.UserEN>();
                        foreach (int entry in dto.Users_oid)
                        {
                            newinstance.Users.Add(userCAD.ReadOIDDefault(entry));
                        }
                    }
                    newinstance.Id          = dto.Id;
                    newinstance.Name        = dto.Name;
                    newinstance.Type        = dto.Type;
                    newinstance.ServiceType = dto.ServiceType;
                    newinstance.Description = dto.Description;

                    if (dto.EntityArgument != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityArgumentCAD entityArgumentCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityArgumentCAD();

                        newinstance.EntityArgument = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityArgumentEN>();
                        foreach (EntityArgumentDTO entry in dto.EntityArgument)
                        {
                            newinstance.EntityArgument.Add(EntityArgumentAssemblerDTO.Convert(entry));
                        }
                    }
                    if (dto.Entity_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD();

                        newinstance.Entity = entityCAD.ReadOIDDefault(dto.Entity_oid);
                    }
                    if (dto.RuleAction_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IRecipeActionCAD recipeActionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeActionCAD();

                        newinstance.RuleAction = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeActionEN>();
                        foreach (int entry in dto.RuleAction_oid)
                        {
                            newinstance.RuleAction.Add(recipeActionCAD.ReadOIDDefault(entry));
                        }
                    }
                    if (dto.OriginState_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD();

                        newinstance.OriginState = entityStateCAD.ReadOIDDefault(dto.OriginState_oid);
                    }
                    if (dto.TargetState_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD();

                        newinstance.TargetState = entityStateCAD.ReadOIDDefault(dto.TargetState_oid);
                    }
                    if (dto.Triggers_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IRecipeTriggerCAD recipeTriggerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeTriggerCAD();

                        newinstance.Triggers = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeTriggerEN>();
                        foreach (int entry in dto.Triggers_oid)
                        {
                            newinstance.Triggers.Add(recipeTriggerCAD.ReadOIDDefault(entry));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }