Example #1
0
        public BO.ServiceStatus <BO.TodoItem> Toggle([FromBody] BO.TodoItem param)
        {
            BO.ServiceStatus <BO.TodoItem> result = new Models.BO.ServiceStatus <BO.TodoItem>();
            try
            {
                int id = param.ID;
                //controllo presenza parametri
                if (id == 0)
                {
                    result.AddError("`id` in required");
                }

                if (result.Messages.Count == 0)
                {
                    result.Data = Code.Manager.Toggle(id);
                    if (result.Data == null)
                    {
                        result.AddError("Error: not toggled");
                    }
                    else
                    {
                        result.AddSuccess("Toggled id: " + id.ToString());
                        result.Success = true;
                    }
                }
            }
            catch (Exception ex)
            {
                result.AddError(ex);
            }
            return(result);
        }
Example #2
0
 public BO.ServiceStatus <BO.TodoItem> Read(int id)
 {
     BO.ServiceStatus <BO.TodoItem> result = new Models.BO.ServiceStatus <Models.BO.TodoItem>();
     try
     {
         result.Data = Code.Manager.Read(id);
         result.AddSuccess("Readed: " + 1);
         result.Success = true;
     }
     catch (Exception ex)
     {
         result.AddError(ex);
     }
     return(result);
 }