Esempio n. 1
0
        public bool Update(long Id, MateriaBE Be)
        {
            try
            {
                var flag = false;

                if (Be != null)
                {
                    var entity = Factory.FactoryMateria.GetInstance().CreateEntity(Be);

                    _puente.MateriaRepository.Update(entity, new List <string>()
                    {
                        "desc_materia", "hs_semanales", "hs_totales"
                    });
                    _puente.Commit();

                    flag = true;
                    return(flag);
                }
                else
                {
                    throw new ApiBusinessException(1012, "No se pudo Modificar el plan", System.Net.HttpStatusCode.NotFound, "Http");
                }
            }
            catch (Exception ex)
            {
                throw HandlerErrorExceptions.GetInstance().RunCustomExceptions(ex);
            }
        }
 public async Task <IHttpActionResult> PostMateria(MateriaBE plan)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _services.Create(plan);
     return(Created(new Uri(Url.Link("DefaultApi", new { Id = plan })), plan));
 }
 public async Task <IHttpActionResult> PutMateria(Int32 id, MateriaBE plan)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     plan.id_materia = id;
     _services.Update(id, plan);
     return(Ok());
 }
        public MateriaDTO CreateDTO(MateriaBE be)
        {
            MateriaDTO dto;

            if (be != null)
            {
                dto = new MateriaDTO()
                {
                    id_materia   = be.id_materia,
                    id_plan      = be.id_plan,
                    desc_materia = be.desc_materia,
                    hs_semanales = be.hs_semanales,
                    hs_totales   = be.hs_totales,
                    estado       = be.estado
                };
                return(dto);
            }
            return(dto = new MateriaDTO());
        }
Esempio n. 5
0
        public DataModel.materias  CreateEntity(MateriaBE be)
        {
            DataModel.materias entity;
            if (be != null)
            {
                entity = new DataModel.materias()
                {
                    id_materia   = be.id_materia,
                    id_plan      = be.id_plan,
                    desc_materia = be.desc_materia,
                    hs_semanales = be.hs_semanales,
                    hs_totales   = be.hs_totales,
                    estado       = be.estado
                };

                return(entity);
            }
            return(entity = new DataModel.materias());
        }
Esempio n. 6
0
        public MateriaBE CreateBusiness(DataModel.materias entity)
        {
            MateriaBE be;

            if (entity != null)
            {
                be = new MateriaBE()
                {
                    id_materia   = entity.id_materia,
                    id_plan      = entity.id_plan,
                    desc_materia = entity.desc_materia,
                    hs_semanales = entity.hs_semanales,
                    hs_totales   = entity.hs_totales,
                    estado       = entity.estado
                };

                return(be);
            }
            return(be = new MateriaBE());
        }
Esempio n. 7
0
        public long Create(MateriaBE Be)
        {
            try
            {
                if (Be != null)
                {
                    DataModel.materias entity = Factory.FactoryMateria.GetInstance().CreateEntity(Be);
                    _puente.MateriaRepository.Insert(entity);
                    _puente.Commit();

                    return(entity.id_materia);
                }
                else
                {
                    throw new ApiBusinessException(1012, "No se pudo crear la materia", System.Net.HttpStatusCode.NotFound, "Http");
                }
            }
            catch (Exception ex)
            {
                throw HandlerErrorExceptions.GetInstance().RunCustomExceptions(ex);
            }
        }