Exemplo n.º 1
0
        /// <summary>The get lineasProductos model.</summary>
        /// <param name="id">The id.</param>
        /// <returns>The <see cref="ContentResult"/>.</returns>
        public ContentResult GetLineasProductosModel(int?id)
        {
            var success  = false;
            var error    = string.Empty;
            var response = new LineasProductos();

            try
            {
                if (id.HasValue && id.Value > 0)
                {
                    response = this.lineasProductosServicios.Get(id.Value);
                }

                success = true;
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            var json = JsonConvert.SerializeObject(
                new
            {
                success,
                error,
                result = response
            },
                new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            return(this.Content(json, "application/json"));
        }
Exemplo n.º 2
0
 public async Task <IHttpActionResult> PutLineasProductos(LineasProductos lineasProductos)
 {
     try
     {
         this.lineasProductosServicios.Edit(lineasProductos);
         return(this.Ok(lineasProductos));
     }
     catch (Exception ex)
     {
         return(this.BadRequest(ex.Message));
     }
 }
Exemplo n.º 3
0
        /// <summary>The edit lineasProductos.</summary>
        /// <param name="lineasProductos">The lineasProductos.</param>
        /// <exception cref="ValidationException"></exception>
        public void Edit(LineasProductos lineasProductos)
        {
            var editLineasProductosValidador          = new EditLineasProductosValidador(this.unidadDeTrabajoProductos.LineasProductosRepositorio);
            var editLineasProductosValidadorResultado = editLineasProductosValidador.Validate(lineasProductos);

            if (!editLineasProductosValidadorResultado.IsValid)
            {
                throw new ValidationException(editLineasProductosValidadorResultado.Errors);
            }

            this.unidadDeTrabajoProductos.LineasProductosRepositorio.Actualizar(lineasProductos);
            this.unidadDeTrabajoProductos.Confirmar();
        }
Exemplo n.º 4
0
        /// <summary>The add lineasProductos.</summary>
        /// <param name="lineasProductos">The lineasProductos.</param>
        public void Add(LineasProductos lineasProductos)
        {
            var addLineasProductosValidador          = new AddLineasProductosValidador(this.unidadDeTrabajoProductos.LineasProductosRepositorio);
            var addLineasProductosValidadorResultado = addLineasProductosValidador.Validate(lineasProductos);

            if (!addLineasProductosValidadorResultado.IsValid)
            {
                throw new ValidationException(addLineasProductosValidadorResultado.Errors);
            }

            this.unidadDeTrabajoProductos.LineasProductosRepositorio.Insertar(lineasProductos);
            this.unidadDeTrabajoProductos.Confirmar();
        }
Exemplo n.º 5
0
 /// <summary>The delete lineasProductos.</summary>
 /// <param name="lineasProductos">The lineasProductos.</param>
 public void Delete(LineasProductos lineasProductos)
 {
     this.unidadDeTrabajoProductos.LineasProductosRepositorio.Eliminar(lineasProductos);
     this.unidadDeTrabajoProductos.Confirmar();
 }
Exemplo n.º 6
0
 public void Delete(LineasProductos lineasProductos)
 {
     this.lineasProductosServicios.Delete(lineasProductos);
 }
Exemplo n.º 7
0
 public async Task <IHttpActionResult> PostLineasProductos(LineasProductos id)
 {
     this.lineasProductosServicios.Add(id);
     return(this.Ok(id));
 }