public TbFdTareaTipo viewToModelSave(TipoTareaViewModel domain)
        {
            TbFdTareaTipo tp = new TbFdTareaTipo();

            tp.Activo = domain.Activo;
            tp.Color  = domain.Color;
            tp.ControlaFechaLimite = domain.ControlaFechaLimite;
            tp.DiasFechaLimite     = domain.DiasFechaLimite;
            tp.EsTipoDefecto       = domain.EsTipoDefecto;
            tp.Titulo        = domain.Titulo;
            tp.FechaCreacion = DateTime.Now;

            return(tp);
        }
        public TbFdTareaTipo viewToModelUpdate(TipoTareaViewModel domain)
        {
            TbFdTareaTipo tp = new TbFdTareaTipo();

            tp        = this.ITipoTareaService.GetById(Convert.ToInt32(domain.Id));
            tp.Activo = domain.Activo;
            tp.Color  = domain.Color;
            tp.ControlaFechaLimite = domain.ControlaFechaLimite;
            tp.DiasFechaLimite     = domain.DiasFechaLimite;
            tp.EsTipoDefecto       = domain.EsTipoDefecto;
            tp.Titulo = domain.Titulo;


            return(tp);
        }
        public JsonResult EditarTipoTarea(TipoTareaViewModel domain)
        {
            TbFdTareaTipo tt         = new TbFdTareaTipo();
            TbFdTareaTipo titulo     = new TbFdTareaTipo();
            TbFdTareaTipo color      = new TbFdTareaTipo();
            TbFdTareaTipo porDefecto = new TbFdTareaTipo();

            titulo     = this.ITipoTareaService.GetTitulo(domain.Titulo);
            color      = this.ITipoTareaService.GetColor(domain.Color);
            porDefecto = this.ITipoTareaService.GetDefecto(true);
            if (this.ITipoTareaService.GetByTitulo(domain.Titulo))
            {
                if (titulo.Id != domain.Id)
                {
                    return(Json(new { titulo = true }));
                }
            }
            if (domain.Color != "#f6faf9")
            {
                if (this.ITipoTareaService.GetByColor(domain.Color))
                {
                    if (color.Id != domain.Id)
                    {
                        return(Json(new { color = true }));
                    }
                }
            }
            if (this.ITipoTareaService.GetByDefecto(domain.EsTipoDefecto) == true)
            {
                if (domain.EsTipoDefecto == true)
                {
                    if (porDefecto.Id != domain.Id)
                    {
                        return(Json(new { defecto = true }));
                    }
                }
            }

            tt = this.ITipoTareaMapper.Update(domain);



            return(Json(new { titulo = false, color = false, defecto = false }));;
        }
 public JsonResult CrearTipo(TipoTareaViewModel domain)
 {
     try
     {
         if (this.ITipoTareaService.GetByTitulo(domain.Titulo))
         {
             return(Json(new { titulo = true }));
         }
         else if (domain.Color != "#f6faf9")
         {
             if (this.ITipoTareaService.GetByColor(domain.Color))
             {
                 return(Json(new { color = true }));
             }
         }
         if (domain.EsTipoDefecto != false)
         {
             if (this.ITipoTareaService.GetByDefecto(domain.EsTipoDefecto))
             {
                 return(Json(new { defecto = true }));
             }
             else
             {
                 var tt = this.ITipoTareaMapper.Save(domain);
             }
         }
         else
         {
             var tt = this.ITipoTareaMapper.Save(domain);
         }
         return(Json(new { titulo = false, color = false, defecto = false }));
     }
     catch
     {
         throw;
     }
 }
 public TbFdTareaTipo Update(TipoTareaViewModel domain)
 {
     return(this.ITipoTareaService.Update(viewToModelUpdate(domain)));
 }
 public TbFdTareaTipo Save(TipoTareaViewModel domain)
 {
     return(this.ITipoTareaService.Save(viewToModelSave(domain)));
 }