public static DetallePedido MapToEntity(DtoDetallePedido dto) { DetallePedido entity = new DetallePedido(); entity.CantidadPreparar = dto.CantidadPreparar; entity.idPedido = dto.idPedido; entity.idProducto = dto.idProducto; entity.PrecioU = dto.PrecioU; entity.UbicacionPro = dto.UbicacionPro; return(entity); }
public static DtoDetallePedido MapToDto(DetallePedido entity) { DtoDetallePedido dto = new DtoDetallePedido(); dto.CantidadPreparar = entity.CantidadPreparar; dto.idPedido = entity.idPedido; dto.idProducto = entity.idProducto; dto.PrecioU = entity.PrecioU; dto.UbicacionPro = entity.UbicacionPro; return(dto); }
//Cliente/Empleado public List <DtoDetallePedido> GetDetalle(int id) { List <DtoDetallePedido> colDtoDetalle = new List <DtoDetallePedido>(); List <DetallePedido> colDetalleDB = new List <DetallePedido>(); using (AliyavaEntities context = new AliyavaEntities()) { colDetalleDB = context.DetallePedido.Where(w => w.idPedido == id).ToList(); foreach (DetallePedido item in colDetalleDB) { DtoDetallePedido detalle = MDetalle.MapToDto(item); colDtoDetalle.Add(detalle); } } return(colDtoDetalle); }
public ClassResultV Usp_InsertDetallePedido(DtoB dtoBase) { DtoDetallePedido dto = (DtoDetallePedido)dtoBase; ClassResultV cr = new ClassResultV(); SqlParameter[] pr = new SqlParameter[4]; try { pr[0] = new SqlParameter("@idPedido", SqlDbType.Int) { Value = dto.@idPedido }; pr[1] = new SqlParameter("@idProducto", SqlDbType.Int) { Value = dto.idProducto }; pr[2] = new SqlParameter("@cantidad", SqlDbType.Int) { Value = dto.cantidad }; pr[3] = new SqlParameter("@precioCompra", SqlDbType.Int) { Value = dto.precioCompra }; _ = SqlHelper.ExecuteNonQuery(objCn, CommandType.StoredProcedure, "SP_Insert_DetallePedido", pr); } catch (Exception ex) { cr.LugarError = ex.StackTrace; cr.ErrorEx = ex.Message; cr.ErrorMsj = "Error al registrar el detalle del Pedido."; } objCn.Close(); return(cr); }